Another abandoned server code base... this is kind of an ancestor of taskrambler.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1489 lines
85 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-US-x-Hixie" ><head><title>7 User interaction &#8212; HTML5 </title><style type="text/css">
pre { margin-left: 2em; white-space: pre-wrap; }
h2 { margin: 3em 0 1em 0; }
h3 { margin: 2.5em 0 1em 0; }
h4 { margin: 2.5em 0 0.75em 0; }
h5, h6 { margin: 2.5em 0 1em; }
h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
p { margin: 1em 0; }
hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
dl, dd { margin-top: 0; margin-bottom: 0; }
dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
dt + dt { margin-top: 0; }
dd dt { margin-top: 0.25em; margin-bottom: 0; }
dd p { margin-top: 0; }
dd dl + p { margin-top: 1em; }
dd table + p { margin-top: 1em; }
p + * > li, dd li { margin: 1em 0; }
dt, dfn { font-weight: bold; font-style: normal; }
dt dfn { font-style: italic; }
pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
pre em { font-weight: bolder; font-style: normal; }
@media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
table { border-collapse: collapse; border-style: hidden hidden none hidden; }
table thead, table tbody { border-bottom: solid; }
table tbody th:first-child { border-left: solid; }
table tbody th { text-align: left; }
table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
.bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
.matrix, .matrix td { border: none; text-align: right; }
.matrix { margin-left: 2em; }
.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; }
.toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
img.extra { float: right; }
pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; }
pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
pre.css:first-line { color: #AAAA50; }
dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
dl.domintro dd p { margin: 0.5em 0; }
dl.switch { padding-left: 2em; }
dl.switch > dt { text-indent: -1.5em; }
dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
dl.triple { padding: 0 0 0 1em; }
dl.triple dt, dl.triple dd { margin: 0; display: inline }
dl.triple dt:after { content: ':'; }
dl.triple dd:after { content: '\A'; white-space: pre; }
.diff-old { text-decoration: line-through; color: silver; background: transparent; }
.diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
a .diff-new { border-bottom: 1px blue solid; }
h2 { page-break-before: always; }
h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
h1 + h2, hr + h2.no-toc { page-break-before: auto; }
p > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]),
li > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]), { border-bottom: solid #9999CC; }
div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
div.head p { margin: 0; }
div.head h1 { margin: 0; }
div.head .logo { float: right; margin: 0 1em; }
div.head .logo img { border: none } /* remove border from top image */
div.head dl { margin: 1em 0; }
div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
body > .toc > li > * { margin-bottom: 0.5em; }
body > .toc > li > * > li > * { margin-bottom: 0.25em; }
.toc, .toc li { list-style: none; }
.brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
.brief li { margin: 0; padding: 0; }
.brief li p { margin: 0; padding: 0; }
.category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
.category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
.category-list li { display: inline; }
.category-list li:not(:last-child)::after { content: ', '; }
.category-list li > span, .category-list li > a { text-transform: lowercase; }
.category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
.XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
.XXX > :first-child { margin-top: 0; }
p .XXX { line-height: 3em; }
.annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
.annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
.annotation :link, .annotation :visited { color: inherit; }
.annotation :link:hover, .annotation :visited:hover { background: transparent; }
.annotation span { border: none ! important; }
.note { color: green; background: transparent; font-family: sans-serif; }
.warning { color: red; background: transparent; }
.note, .warning { font-weight: bolder; font-style: italic; }
p.note, div.note { padding: 0.5em 2em; }
span.note { padding: 0 2em; }
.note p:first-child, .warning p:first-child { margin-top: 0; }
.note p:last-child, .warning p:last-child { margin-bottom: 0; }
.warning:before { font-style: normal; }
p.note:before { content: 'Note: '; }
p.warning:before { content: '\26A0 Warning! '; }
.bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
.bookkeeping { font-size: 0.8em; margin: 2em 0; }
.bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
.bookkeeping dt { margin: 0.5em 2em 0; }
.bookkeeping dd { margin: 0 3em 0.5em; }
h4 { position: relative; z-index: 3; }
h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
.element {
background: #EEEEFF;
color: black;
margin: 0 0 1em 0.15em;
padding: 0 1em 0.25em 0.75em;
border-left: solid #9999FF 0.25em;
position: relative;
z-index: 1;
}
.element:before {
position: absolute;
z-index: 2;
top: 0;
left: -1.15em;
height: 2em;
width: 0.9em;
background: #EEEEFF;
content: ' ';
border-style: none none solid solid;
border-color: #9999FF;
border-width: 0.25em;
}
.example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
td > .example:only-child { margin: 0 0 0 0.1em; }
ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
ul.domTree li li { list-style: none; }
ul.domTree li:first-child::before { position: absolute; top: 0; height: 0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
ul.domTree li:not(:last-child)::after { position: absolute; top: 0; bottom: -0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
ul.domTree span { font-style: italic; font-family: serif; }
ul.domTree .t1 code { color: purple; font-weight: bold; }
ul.domTree .t2 { font-style: normal; font-family: monospace; }
ul.domTree .t2 .name { color: black; font-weight: bold; }
ul.domTree .t2 .value { color: blue; font-weight: normal; }
ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
ul.domTree .t7 code, .domTree .t8 code { color: green; }
ul.domTree .t10 code { color: teal; }
body.dfnEnabled dfn { cursor: pointer; }
.dfnPanel {
display: inline;
position: absolute;
z-index: 10;
height: auto;
width: auto;
padding: 0.5em 0.75em;
font: small sans-serif, Droid Sans Fallback;
background: #DDDDDD;
color: black;
border: outset 0.2em;
}
.dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
.dfnPanel :link, .dfnPanel :visited { color: black; }
.dfnPanel p { font-weight: bolder; }
.dfnPanel * + p { margin-top: 0.25em; }
.dfnPanel li { list-style-position: inside; }
#configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
#configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
#configUI p label { display: block; }
#configUI #updateUI, #configUI .loginUI { text-align: center; }
#configUI input[type=button] { display: block; margin: auto; }
fieldset { margin: 1em; padding: 0.5em 1em; }
fieldset > legend + * { margin-top: 0; }
fieldset > :last-child { margin-bottom: 0; }
fieldset p { margin: 0.5em 0; }
.stability {
position: fixed;
bottom: 0;
left: 0; right: 0;
margin: 0 auto 0 auto !important;
z-index: 1000;
width: 50%;
background: maroon; color: yellow;
-webkit-border-radius: 1em 1em 0 0;
-moz-border-radius: 1em 1em 0 0;
border-radius: 1em 1em 0 0;
-moz-box-shadow: 0 0 1em #500;
-webkit-box-shadow: 0 0 1em #500;
box-shadow: 0 0 1em red;
padding: 0.5em 1em;
text-align: center;
}
.stability strong {
display: block;
}
.stability input {
appearance: none; margin: 0; border: 0; padding: 0.25em 0.5em; background: transparent; color: black;
position: absolute; top: -0.5em; right: 0; font: 1.25em sans-serif; text-align: center;
}
.stability input:hover {
color: white;
text-shadow: 0 0 2px black;
}
.stability input:active {
padding: 0.3em 0.45em 0.2em 0.55em;
}
.stability :link, .stability :visited,
.stability :link:hover, .stability :visited:hover {
background: transparent;
color: white;
}
</style><link href="data:text/css,.impl%20%7B%20display:%20none;%20%7D%0Ahtml%20%7B%20border:%20solid%20yellow;%20%7D%20.domintro:before%20%7B%20display:%20none;%20%7D" id="author" rel="alternate stylesheet" title="Author documentation only"><link href="data:text/css,.impl%20%7B%20background:%20%23FFEEEE;%20%7D%20.domintro:before%20%7B%20background:%20%23FFEEEE;%20%7D" id="highlight" rel="alternate stylesheet" title="Highlight implementation
requirements"><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css"><style type="text/css">
.applies thead th > * { display: block; }
.applies thead code { display: block; }
.applies tbody th { whitespace: nowrap; }
.applies td { text-align: center; }
.applies .yes { background: yellow; }
.matrix, .matrix td { border: hidden; text-align: right; }
.matrix { margin-left: 2em; }
.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; }
.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><style type="text/css">
.domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
</style><script type="text/javascript">
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;
}
</script>
<script src="link-fixup.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet"><link href="timers.html" title="6.3 Timers" rel="prev">
<link href="spec.html#contents" title="Table of contents" rel="index">
<link href="dnd.html" title="7.7 Drag and drop" rel="next">
</head><body><div class="head" id="head">
<div id="multipage-common">
<p class="stability" id="wip"><strong>This is a work in
progress!</strong> For the latest updates from the HTML WG, possibly
including important bug fixes, please look at the <a href="http://dev.w3.org/html5/spec/Overview.html">editor's draft</a> instead.
There may also be a more
<a href="http://www.w3.org/TR/html5">up-to-date Working Draft</a>
with changes based on resolution of Last Call issues.
<input onclick="closeWarning(this.parentNode)" type="button" value="&#9587;&#8413;"></p>
<script type="text/javascript">
function closeWarning(element) {
element.parentNode.removeChild(element);
var date = new Date();
date.setDate(date.getDate()+4);
document.cookie = 'hide-obsolescence-warning=1; expires=' + date.toGMTString();
}
if (getCookie('hide-obsolescence-warning') == '1')
setTimeout(function () { document.getElementById('wip').parentNode.removeChild(document.getElementById('wip')); }, 2000);
</script></div>
<p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
<h1>HTML5</h1>
</div><div>
<a href="timers.html" class="prev">6.3 Timers</a> &#8211;
<a href="spec.html#contents">Table of contents</a> &#8211;
<a href="dnd.html" class="next">7.7 Drag and drop</a>
<ol class="toc"><li><a href="editing.html#editing"><span class="secno">7 </span>User interaction</a>
<ol><li><a href="editing.html#the-hidden-attribute"><span class="secno">7.1 </span>The <code>hidden</code> attribute</a></li><li><a href="editing.html#activation"><span class="secno">7.2 </span>Activation</a></li><li><a href="editing.html#focus"><span class="secno">7.3 </span>Focus</a>
<ol><li><a href="editing.html#sequential-focus-navigation-and-the-tabindex-attribute"><span class="secno">7.3.1 </span>Sequential focus navigation and the <code title="attr-tabindex">tabindex</code> attribute</a></li><li><a href="editing.html#focus-management"><span class="secno">7.3.2 </span>Focus management</a></li><li><a href="editing.html#document-level-focus-apis"><span class="secno">7.3.3 </span>Document-level focus APIs</a></li><li><a href="editing.html#element-level-focus-apis"><span class="secno">7.3.4 </span>Element-level focus APIs</a></li></ol></li><li><a href="editing.html#assigning-keyboard-shortcuts"><span class="secno">7.4 </span>Assigning keyboard shortcuts</a>
<ol><li><a href="editing.html#introduction-6"><span class="secno">7.4.1 </span>Introduction</a></li><li><a href="editing.html#the-accesskey-attribute"><span class="secno">7.4.2 </span>The <code>accesskey</code> attribute</a></li><li><a href="editing.html#processing-model-3"><span class="secno">7.4.3 </span>Processing model</a></li></ol></li><li><a href="editing.html#contenteditable"><span class="secno">7.5 </span>The <code title="attr-contenteditable">contenteditable</code> attribute</a>
<ol><li><a href="editing.html#user-editing-actions"><span class="secno">7.5.1 </span>User editing actions</a></li><li><a href="editing.html#making-entire-documents-editable"><span class="secno">7.5.2 </span>Making entire documents editable</a></li></ol></li><li><a href="editing.html#spelling-and-grammar-checking"><span class="secno">7.6 </span>Spelling and grammar checking</a></li></ol></li></ol></div>
<h2 id="editing"><span class="secno">7 </span><dfn>User interaction</dfn></h2><h3 id="the-hidden-attribute"><span class="secno">7.1 </span>The <dfn title="attr-hidden"><code>hidden</code></dfn> attribute</h3><p>All <a href="infrastructure.html#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="common-microsyntaxes.html#boolean-attribute">boolean
attribute</a>. When specified on an element, it indicates that
the element is not yet, or is no longer, relevant. <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 &#8212; 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
&#8212; 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><p>Elements that are not <code title="attr-hidden"><a href="#the-hidden-attribute">hidden</a></code>
should not link to or refer to elements that are <code title="attr-hidden"><a href="#the-hidden-attribute">hidden</a></code>.</p><div class="example">
<p>For example, it would be incorrect to use the <code title="attr-hyperlink-href"><a href="links.html#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 similarly be incorrect 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>. Hiding a section means that it
is not applicable or relevant to anyone at the current time, so
clearly it cannot be a valid description of content the user can
interact with.</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="common-dom-interfaces.html#reflect">reflect</a> the content attribute of the
same name.</p>
</div><h3 id="activation"><span class="secno">7.2 </span>Activation</h3><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>Each element has a <var title="">click in progress</var> flag,
initially set to false.</p>
<p>The <dfn id="dom-click" title="dom-click"><code>click()</code></dfn> method 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.</p></li>
<li><p>Set the <var title="">click in progress</var> flag on the
element to true.</p></li>
<li><p>If the element has a defined <a href="content-models.html#activation-behavior">activation behavior</a>,
<a href="content-models.html#run-synthetic-click-activation-steps">run synthetic click activation steps</a> on the
element. Otherwise, <a href="webappapis.html#fire-a-click-event">fire a <code>click</code> event</a> at
the element.</p></li>
<li><p>Set the <var title="">click in progress</var> flag on the
element to false.</p></li>
</ol></div><h3 id="focus"><span class="secno">7.3 </span>Focus</h3><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="dom.html#the-body-element-0">the body element</a>.</p>
<p>User agents may track focus for each <a href="browsers.html#browsing-context">browsing
context</a> or <code><a href="infrastructure.html#document">Document</a></code> individually, or may support
only one focused element per <a href="browsers.html#top-level-browsing-context">top-level browsing context</a>
&#8212; user agents should follow platform conventions in this
regard.</p>
<p>Which elements within a <a href="browsers.html#top-level-browsing-context">top-level browsing context</a>
currently have focus must be independent of whether or not the
<a href="browsers.html#top-level-browsing-context">top-level browsing context</a> itself has the <i>system
focus</i>.</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">7.3.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 specifies whether the element is focusable,
whether it can be reached using sequential focus navigation, and 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="common-microsyntaxes.html#valid-integer">valid
integer</a>.</p><div class="impl">
<p>If the attribute is specified, it must be parsed using the
<a href="common-microsyntaxes.html#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 is to be focusable and, if so, whether the element can
be reached using sequential focus navigation, and if so, what its
relative order should be.</p>
</dd>
<dt id="negative-tabindex">If the value is a negative integer</dt>
<dd>
<p>The user agent must allow the element to be focused, but should
not allow the element to be reached using sequential focus
navigation.</p>
</dd>
<dt>If the value is a zero</dt>
<dd>
<p>The user agent must allow the element to be focused, 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 allow the element to be focused, 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 focusable 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 focusable 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="infrastructure.html#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="infrastructure.html#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 is <dfn id="specially-focusable">specially focusable</dfn> if the <code title="attr-tabindex"><a href="#attr-tabindex">tabindex</a></code> attribute's definition above
defines the element to be focusable.</p>
<p>An element that is <a href="#specially-focusable">specially focusable</a> but does not
otherwise have an <a href="content-models.html#activation-behavior">activation behavior</a> defined has an
<a href="content-models.html#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="infrastructure.html#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="common-dom-interfaces.html#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 &#8722;1 for
elements that are not focusable.</p>
</div><div class="impl">
<h4 id="focus-management"><span class="secno">7.3.2 </span>Focus management</h4>
<p>An element is <dfn id="focusable">focusable</dfn> if the user agent's default
behavior allows it to be focusable or if the element is
<a href="#specially-focusable">specially focusable</a>, but only if the element is either
<a href="rendering.html#being-rendered">being rendered</a> or <!-- CANVAS-FOCUS-FALLBACK --> is a
descendant of a <code><a href="the-canvas-element.html#the-canvas-element">canvas</a></code> element that
<a href="rendering.html#represents">represents</a> <a href="content-models.html#embedded-content">embedded content</a>.</p>
<p>User agents should make the following elements
<a href="#focusable">focusable</a>, unless platform conventions dictate
otherwise:</p>
<ul><li><code><a href="text-level-semantics.html#the-a-element">a</a></code> elements that have an <code title="attr-hyperlink-href"><a href="links.html#attr-hyperlink-href">href</a></code> attribute</li>
<li><code><a href="semantics.html#the-link-element">link</a></code> elements that have an <code title="attr-link-href"><a href="semantics.html#attr-link-href">href</a></code> attribute</li>
<li><code><a href="the-button-element.html#the-button-element">button</a></code> elements that are not <a href="association-of-controls-and-forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
<li><code><a href="the-input-element.html#the-input-element">input</a></code> elements whose <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute are not in the
<a href="states-of-the-type-attribute.html#hidden-state" title="attr-input-type-hidden">Hidden</a> state and that
are not <a href="association-of-controls-and-forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
<li><code><a href="the-button-element.html#the-select-element">select</a></code> elements that are not <a href="association-of-controls-and-forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
<li><code><a href="the-button-element.html#the-textarea-element">textarea</a></code> elements that are not <a href="association-of-controls-and-forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
<li><code><a href="interactive-elements.html#the-command-element">command</a></code> elements that do not have a <code title="attr-command-disabled"><a href="interactive-elements.html#attr-command-disabled">disabled</a></code> attribute</li>
<li>Elements with a <code title="attr-draggable"><a href="dnd.html#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>
</ul><p>In addition, each shape that is generated for an
<code><a href="the-map-element.html#the-area-element">area</a></code> element should be <a href="#focusable">focusable</a>, unless
platform conventions dictate otherwise. (A single <code><a href="the-map-element.html#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="interactive-elements.html#the-details-element">details</a></code>
element's rendering focusable, to enable the element to be opened or
closed using keyboard input. However, this is distinct from the
<code><a href="interactive-elements.html#the-details-element">details</a></code> or <code><a href="interactive-elements.html#the-summary-element">summary</a></code> element being
focusable.</p>
<hr><p>The <dfn id="focusing-steps">focusing steps</dfn> are as follows:</p>
<ol><li><p>If the element is not <a href="infrastructure.html#in-a-document" title="in a Document">in a
<code>Document</code></a>, or if the element's
<code><a href="infrastructure.html#document">Document</a></code> has no <a href="browsers.html#browsing-context">browsing context</a>, or if
the element's <code><a href="infrastructure.html#document">Document</a></code>'s <a href="browsers.html#browsing-context">browsing context</a>
has no <a href="browsers.html#top-level-browsing-context">top-level browsing context</a>, then abort these
steps.</p>
</li><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.</p></li>
<li>
<p>Make the element the currently focused element in its
<a href="browsers.html#top-level-browsing-context">top-level browsing context</a>.</p>
<p>Some elements, most notably <code><a href="the-map-element.html#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="webappapis.html#fire-a-simple-event">Fire a simple event</a> named <code title="event-focus">focus</code> at the element.</p></li>
</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> are as follows:</p>
<ol><li><p>If the element is an <code><a href="the-input-element.html#the-input-element">input</a></code> element, and the
<code title="event-input-change"><a href="common-input-element-attributes.html#event-input-change">change</a></code> event applies to the
element, and the element does not have a defined <a href="content-models.html#activation-behavior">activation
behavior</a>, and the user has changed the element's <a href="association-of-controls-and-forms.html#concept-fe-value" title="concept-fe-value">value</a> or its list of <a href="number-state.html#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="webappapis.html#fire-a-simple-event">fire a simple event</a> that bubbles named <code title="event-change">change</code> at the element.</p>
</li><li><p>Unfocus the element.</p></li>
<li><p><a href="webappapis.html#fire-a-simple-event">Fire a simple event</a> named <code title="event-blur">blur</code> at the element.</p></li>
</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="#focusing-steps">focusing steps</a> for
<a href="dom.html#the-body-element-0">the body element</a>, if there is one; if there is not,
then 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="infrastructure.html#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.html#the-input-element">input</a></code> element when the element gets <a href="association-of-controls-and-forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a>.</p>
</div><h4 id="document-level-focus-apis"><span class="secno">7.3.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="dom.html#htmldocument">HTMLDocument</a></code> objects must return the
element in the document that is focused. If no element in the
<code><a href="infrastructure.html#document">Document</a></code> is focused, this must return <a href="dom.html#the-body-element-0">the body
element</a>.</p>
<p>The <dfn id="dom-document-hasfocus" title="dom-document-hasFocus"><code>hasFocus()</code></dfn> method
on <code><a href="dom.html#htmldocument">HTMLDocument</a></code> objects must return true if the
<code><a href="infrastructure.html#document">Document</a></code>'s <a href="browsers.html#browsing-context">browsing context</a> is focused,
and all its <a href="browsers.html#ancestor-browsing-context" title="ancestor browsing context">ancestor
browsing contexts</a> are also focused, and the <a href="browsers.html#top-level-browsing-context">top-level
browsing context</a> has the <i>system focus</i>. If the
<code><a href="infrastructure.html#document">Document</a></code> has no <a href="browsers.html#browsing-context">browsing context</a> or if its
<a href="browsers.html#browsing-context">browsing context</a> has no <a href="browsers.html#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="browsers.html#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="browsers.html#browsing-context">browsing context</a> of
the <code><a href="browsers.html#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="browsers.html#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="browsers.html#browsing-context">browsing
context</a> of the <code><a href="browsers.html#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">7.3.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.</p>
<div class="example">
<p>For example, to hide the outline from links, you could use:</p>
<pre>:link:focus, :visited:focus { outline: none; }</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.</p></li>
<li><p>If the element is not <a href="#focusable">focusable</a>, then abort these
steps.</p></li>
<li><p>Mark the element as <dfn id="locked-for-focus">locked for focus</dfn>.</p></li>
<li><p>If the element is not already focused, run the <a href="#focusing-steps">focusing
steps</a> for the element.</p></li>
<li><p>Unmark the element as <i><a href="#locked-for-focus">locked for focus</a></i>.</p></li>
</ol><p>The <dfn id="dom-blur" title="dom-blur"><code>blur()</code></dfn> method, when
invoked, should run the <a href="#focusing-steps">focusing steps</a> for <a href="dom.html#the-body-element-0">the
body element</a>, if there is one; if there is not, then it
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><h3 id="assigning-keyboard-shortcuts"><span class="secno">7.4 </span>Assigning keyboard shortcuts</h3><h4 id="introduction-6"><span class="secno">7.4.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><h4 id="the-accesskey-attribute"><span class="secno">7.4.2 </span>The <dfn title="attr-accesskey"><code>accesskey</code></dfn> attribute</h4><p>All <a href="infrastructure.html#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="common-microsyntaxes.html#ordered-set-of-unique-space-separated-tokens">ordered set of unique
space-separated tokens</a> that are <a href="infrastructure.html#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>S</kbd></kbd> as the
shortcut key, while a user agent on a small device with just a
numeric keypad might pick just the plain unadorned key
<kbd><kbd>0</kbd></kbd>:</p>
<pre>&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 (&#8984;N)</samp>". On another, it might become
"<samp>Compose (Alt+&#8679;+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-3"><span class="secno">7.4.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.</p></li>
<li><p>Otherwise, <a href="common-microsyntaxes.html#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.</p></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.</p></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.</p></li>
<li><p>If the user agent can find a combination of modifier keys
that, with the key that corresponds to the value given in the
attribute, can be used as a shortcut 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.</p></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.</p></li>
<li><p>If this step is reached, the element has no <a href="#assigned-access-key">assigned
access key</a>.</p></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="infrastructure.html#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="commands.html#concept-command" title="concept-command">defines a command</a>, and the
command's <a href="commands.html#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden
State</a> facet is false (visible), and the command's <a href="commands.html#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a> facet is
also false (enabled), then the user agent must trigger the <a href="commands.html#command-facet-action" title="command-facet-Action">Action</a> of the command.</p>
<p>User agents may expose 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>
<p>The <dfn id="dom-accesskey" title="dom-accessKey"><code>accessKey</code></dfn> IDL
attribute must <a href="common-dom-interfaces.html#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="contenteditable"><span class="secno">7.5 </span>The <code title="attr-contenteditable"><a href="#attr-contenteditable">contenteditable</a></code> attribute</h3><p>The <dfn id="attr-contenteditable" title="attr-contenteditable"><code>contenteditable</code></dfn>
attribute is an <a href="common-microsyntaxes.html#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><div class="impl">
<p>Specifically, if an <a href="infrastructure.html#html-elements" title="HTML elements">HTML
element</a> has a <code title="attr-contenteditable"><a href="#attr-contenteditable">contenteditable</a></code> attribute set to
the true state, or it has its <code title="attr-contenteditable"><a href="#attr-contenteditable">contenteditable</a></code> attribute set to
the inherit state and if its nearest ancestor <a href="infrastructure.html#html-elements" title="HTML
elements">HTML element</a> with the <code title="attr-contenteditable"><a href="#attr-contenteditable">contenteditable</a></code> attribute set to
a state other than the inherit state has its attribute set to the
true state, or if it and its ancestors all have their <code title="attr-contenteditable"><a href="#attr-contenteditable">contenteditable</a></code> attribute set to
the inherit state but the <code><a href="infrastructure.html#document">Document</a></code> has <code title="dom-document-designMode"><a href="#designMode">designMode</a></code> enabled, then the
UA must treat the element as <dfn id="editable">editable</dfn> (as described
below).</p>
<p>Otherwise, either the <a href="infrastructure.html#html-elements" title="HTML elements">HTML
element</a> has a <code title="attr-contenteditable"><a href="#attr-contenteditable">contenteditable</a></code> attribute set to
the false state, or its <code title="attr-contenteditable"><a href="#attr-contenteditable">contenteditable</a></code> attribute is set
to the inherit state and its nearest ancestor <a href="infrastructure.html#html-elements" title="HTML
elements">HTML element</a> with the <code title="attr-contenteditable"><a href="#attr-contenteditable">contenteditable</a></code> attribute set to
a state other than the inherit state has its attribute set to the
false state, or all its ancestors have their <code title="attr-contenteditable"><a href="#attr-contenteditable">contenteditable</a></code> attribute set to
the inherit state and the <code><a href="infrastructure.html#document">Document</a></code> itself has <code title="dom-document-designMode"><a href="#designMode">designMode</a></code> disabled; either
way, the element is not editable.</p>
</div><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="common-dom-interfaces.html#syntax_err">SYNTAX_ERR</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="infrastructure.html#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="infrastructure.html#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="infrastructure.html#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 raise a <code><a href="common-dom-interfaces.html#syntax_err">SYNTAX_ERR</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
<a href="#editable">editable</a>, and false otherwise.</p>
<p>If an element is <a href="#editable">editable</a> and its parent element is
not, or if an element is <a href="#editable">editable</a> and it has no parent
element, then the element is an <dfn id="editing-host">editing host</dfn>. Editable
elements can be nested. Editing hosts are typically focusable and
typically form part of the <a href="#attr-tabindex" title="attr-tabindex">tab
order</a>. An editing host can contain non-editable sections,
these are handled as described below. An editing host can contain
non-editable sections that contain further editing hosts.</p>
<p>When an editing host has focus, it must have a <dfn id="caret-position">caret
position</dfn> that specifies where the current editing position is.
It may also have a selection.</p>
<p class="note">How the caret and selection are represented depends
entirely on the UA.</p>
</div><div class="impl">
<h4 id="user-editing-actions"><span class="secno">7.5.1 </span>User editing actions</h4>
<p>There are several actions that the user agent should allow the
user to perform while the user is interacting with an editing
host. How exactly each action is triggered is not defined for every
action, but when it is not defined, suggested key bindings are
provided to guide implementors.</p>
<dl><dt>Move the caret</dt>
<dd><p>User agents must allow users to move the caret to any
position within an editing host, even into nested editable
elements. This could be triggered as the default action of <code title="event-keydown">keydown</code> events with various key
identifiers and as the default action of <code title="event-mousedown">mousedown</code> events.</p></dd>
<dt>Change the selection</dt>
<dd><p>User agents must allow users to change the selection within
an editing host, even into nested editable elements. User agents
may prevent selections from being made in ways that cross from
editable elements into non-editable elements (e.g. by making each
non-editable descendant atomically selectable, but not allowing
text selection within them). This could be triggered as the default
action of <code title="event-keydown">keydown</code> events with
various key identifiers and as the default action of <code title="event-mousedown">mousedown</code> events.</p></dd>
<dt id="contenteditable-insertText">Insert text</dt>
<dd><p>This action must be triggered as the default action of a
<code title="event-textInput">textInput</code> event, and may be
triggered by other commands as well. It must cause the user agent
to insert the specified text (given by the event object's <code title="">data</code> attribute in the case of the <code title="event-textInput">textInput</code> event) at the caret.</p>
<p>If the caret is positioned somewhere where <a href="content-models.html#phrasing-content">phrasing
content</a> is not allowed (e.g. inside an empty <code><a href="grouping-content.html#the-ol-element">ol</a></code>
element), then the user agent must not insert the text directly at
the caret position. In such cases the behavior is UA-dependent,
but user agents must not, in response to a request to insert text,
generate a DOM that is less conformant than the DOM prior to the
request.</p>
<p>User agents should allow users to insert new paragraphs into
elements that contains only content other than paragraphs.</p>
<div class="example">
<p>For example, given the markup:</p>
<pre>&lt;section&gt;
&lt;dl&gt;
&lt;dt&gt; Ben &lt;/dt&gt;
&lt;dd&gt; Goat &lt;/dd&gt;
&lt;/dl&gt;
&lt;/section&gt;</pre>
<p>...the user agent should allow the user to insert
<code><a href="grouping-content.html#the-p-element">p</a></code> elements before and after the <code><a href="grouping-content.html#the-dl-element">dl</a></code>
element, as children of the <code><a href="sections.html#the-section-element">section</a></code> element.</p>
</div>
</dd>
<dt id="contenteditable-breakBlock">Break block</dt>
<dd><p>UAs should offer a way for the user to request that the
current paragraph be broken at the caret, e.g. as the default
action of a <code title="event-keydown">keydown</code> event whose
identifier is the "Enter" key and that has no modifiers set.</p>
<p>The exact behavior is UA-dependent, but user agents must not,
in response to a request to break a paragraph, generate a DOM that
is less conformant than the DOM prior to the request.</p></dd>
<dt id="contenteditable-br">Insert a line separator</dt>
<dd><p>UAs should offer a way for the user to request an explicit
line break at the caret position without breaking the paragraph,
e.g. as the default action of a <code title="event-keydown">keydown</code> event whose identifier is the
"Enter" key and that has a shift modifier set. Line separators are
typically found within a poem verse or an address. To insert a line
break, the user agent must insert a <code><a href="text-level-semantics.html#the-br-element">br</a></code> element.</p>
<p>If the caret is positioned somewhere where <a href="content-models.html#phrasing-content">phrasing
content</a> is not allowed (e.g. in an empty <code><a href="grouping-content.html#the-ol-element">ol</a></code>
element), then the user agent must not insert the <code><a href="text-level-semantics.html#the-br-element">br</a></code>
element directly at the caret position. In such cases the behavior
is UA-dependent, but user agents must not, in response to a request
to insert a line separator, generate a DOM that is less conformant
than the DOM prior to the request.</p></dd>
<dt id="contenteditable-delete">Delete</dt>
<dd><p>UAs should offer a way for the user to delete text and
elements, including non-editable descendants, e.g. as the default
action of <code title="event-keydown">keydown</code> events whose
identifiers are "U+0008" or "U+007F".</p>
<p>Five edge cases in particular need to be considered carefully
when implementing this feature: backspacing at the start of an
element, backspacing when the caret is immediately after an
element, forward-deleting at the end of an element,
forward-deleting when the caret is immediately before an element,
and deleting a selection whose start and end points do not share a
common parent node.</p>
<p>In any case, the exact behavior is UA-dependent, but user
agents must not, in response to a request to delete text or an
element, generate a DOM that is less conformant than the DOM prior
to the request.</p></dd>
<dt id="contenteditable-wrapSemantic">Insert, and wrap text in,
semantic elements</dt>
<dd><p>UAs should offer the user the ability to mark text and
paragraphs with semantics that HTML can express.</p>
<p>UAs should similarly offer a way for the user to insert empty
semantic elements to subsequently fill by entering text
manually.</p>
<p>UAs should also offer a way to remove those semantics from
marked up text, and to remove empty semantic element that have been
inserted.</p>
<p>In response to a request from a user to mark text up in italics,
user agents should use the <code><a href="text-level-semantics.html#the-i-element">i</a></code> element to represent the
semantic. The <code><a href="text-level-semantics.html#the-em-element">em</a></code> element should be used only if the
user agent is sure that the user means to indicate stress
emphasis.</p>
<p>In response to a request from a user to mark text up in bold,
user agents should use the <code><a href="text-level-semantics.html#the-b-element">b</a></code> element to represent the
semantic. The <code><a href="text-level-semantics.html#the-strong-element">strong</a></code> element should be used only if
the user agent is sure that the user means to indicate
importance.</p>
<p>The exact behavior is UA-dependent, but user agents must not,
in response to a request to wrap semantics around some text or to
insert or remove a semantic element, generate a DOM that is less
conformant than the DOM prior to the request.</p></dd>
<dt>Select and move non-editable elements nested inside editing hosts</dt>
<dd><p>UAs should offer a way for the user to move images and other
non-editable parts around the content within an editing host. This
may be done using the <a href="dnd.html#dnd">drag and drop</a> mechanism. User
agents must not, in response to a request to move non-editable
elements nested inside editing hosts, generate a DOM that is less
conformant than the DOM prior to the request.</p></dd>
<dt>Edit form controls nested inside editing hosts</dt>
<dd><p>When an <a href="#editable">editable</a> form control is edited, the
changes must be reflected in both its current value <em>and</em>
its default value. For <code><a href="the-input-element.html#the-input-element">input</a></code> elements this means
updating the <code title="dom-input-defaultValue"><a href="the-input-element.html#dom-input-defaultvalue">defaultValue</a></code> IDL attribute as
well as the <code title="dom-input-value"><a href="common-input-element-attributes.html#dom-input-value">value</a></code> IDL
attribute; for <code><a href="the-button-element.html#the-select-element">select</a></code> elements it means updating the
<code><a href="the-button-element.html#the-option-element">option</a></code> elements' <code title="dom-option-defaultSelected"><a href="the-button-element.html#dom-option-defaultselected">defaultSelected</a></code> IDL
attribute as well as the <code title="dom-option-selected"><a href="the-button-element.html#dom-option-selected">selected</a></code> IDL attribute; for
<code><a href="the-button-element.html#the-textarea-element">textarea</a></code> elements this means updating the <code title="dom-textarea-defaultValue"><a href="the-button-element.html#dom-textarea-defaultvalue">defaultValue</a></code> IDL attribute
as well as the <code title="dom-textarea-value"><a href="the-button-element.html#dom-textarea-value">value</a></code> IDL
attribute. (Updating the <code title="">default*</code> IDL
attributes causes content attributes to be updated as well.)</p></dd>
</dl><p>User agents may perform several commands per user request; for
example if the user selects a block of text and hits
<kbd><kbd>Enter</kbd></kbd>, the UA might interpret that as a
request to delete the content of the selection followed by a request
to break the paragraph at that position.</p>
<p>User agents may add <span>DOM changes</span> entries to the
<span>undo transaction history</span> of the <a href="#editing-host">editing
host</a>'s <code><a href="infrastructure.html#document">Document</a></code> object each time an action is
triggered.</p>
<p>All of the actions defined above, whether triggered by the user
or programmatically (e.g. by <code title="dom-document-execCommand"><a href="dnd.html#execCommand">execCommand()</a></code> commands),
must fire mutation events as appropriate.</p>
</div><h4 id="making-entire-documents-editable"><span class="secno">7.5.2 </span>Making entire documents editable</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.</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="infrastructure.html#document">Document</a></code> object takes two values,
"<code title="">on</code>" and "<code title="">off</code>". When it
is set, the new value must be compared in an <a href="infrastructure.html#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>When <code title="dom-document-designMode"><a href="#designMode">designMode</a></code> is
enabled, the IDL attribute must return the value "<code title="">on</code>", and when it is disabled, it 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>
</div><h3 id="spelling-and-grammar-checking"><span class="secno">7.6 </span>Spelling and grammar checking</h3><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-button-element.html#the-textarea-element">textarea</a></code> elements), or in elements in an <a href="#editing-host">editing
host</a> (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>
</dt><dd>The element will be checked for spelling and grammar if its
contents are editable.
</dd><dt><dfn id="concept-spellcheck-default-false" title="concept-spellcheck-default-false">false-by-default</dfn>
</dt><dd>The element will never be checked for spelling and grammar.
</dd><dt><dfn id="concept-spellcheck-default-inherit" title="concept-spellcheck-default-inherit">inherit-by-default</dfn>
</dt><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.
</dd></dl><hr></div><p>The <dfn id="attr-spellcheck" title="attr-spellcheck"><code>spellcheck</code></dfn>
attribute is an <a href="common-microsyntaxes.html#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>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. 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>
</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>".
</p><hr><p>User agents must only consider the following pieces of text as
checkable for the purposes of this feature:</p>
<ul><li>The value of <code><a href="the-input-element.html#the-input-element">input</a></code> elements to which the <code title="attr-input-readonly"><a href="common-input-element-attributes.html#attr-input-readonly">readonly</a></code> attribute applies,
whose <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attributes are not
in the <a href="states-of-the-type-attribute.html#password-state" title="attr-input-type-password">Password</a>
state, and that are not <i title="concept-input-immutable"><a href="the-input-element.html#concept-input-immutable">immutable</a></i> (i.e. that do not
have the <code title="attr-input-readonly"><a href="common-input-element-attributes.html#attr-input-readonly">readonly</a></code>
attribute specified and that are not <a href="association-of-controls-and-forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a>).</li>
<li>The value of <code><a href="the-button-element.html#the-textarea-element">textarea</a></code> elements that do not have a
<code title="attr-textarea-readonly"><a href="the-button-element.html#attr-textarea-readonly">readonly</a></code> attribute and
that are not <a href="association-of-controls-and-forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a>.</li>
<li>Text in <a href="infrastructure.html#text-node" title="text node">text nodes</a> that are
children of <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 <a href="infrastructure.html#text-node">text node</a>, 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.html#the-input-element">input</a></code> and
<code><a href="the-button-element.html#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/or
grammar-checking enabled, the UA must use the following
algorithm:</p>
<ol><li>If the user has disabled the checking for this text, then the
checking is disabled.</li>
<li>Otherwise, if the user has forced the checking for this text to
always be enabled, then the checking is enabled.</li>
<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>
<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>
<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>
<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/or 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.html#the-input-element">input</a></code> element attributes such as <code title="attr-input-pattern"><a href="common-input-element-attributes.html#attr-input-pattern">pattern</a></code> to ensure that the
resulting value is valid, where possible.</p>
<p>If checking is disabled, the user agent should not indicate
spelling or grammar errors for that text.</p>
<div 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.html#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>&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></body></html>