Annotation of html5/spec/sections.html, revision 1.3
1.1 mike 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
2: <!DOCTYPE html>
3: <!-- when publishing, change bits marked ZZZ --><html lang="en-US-x-Hixie" class="split chapter"><head><title>4.4 Sections — HTML5 </title><style type="text/css">
4: pre { margin-left: 2em; white-space: pre-wrap; }
5: h2 { margin: 3em 0 1em 0; }
6: h3 { margin: 2.5em 0 1em 0; }
7: h4 { margin: 2.5em 0 0.75em 0; }
8: h5, h6 { margin: 2.5em 0 1em; }
9: h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
10: h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
11: p { margin: 1em 0; }
12: hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
13: dl, dd { margin-top: 0; margin-bottom: 0; }
14: dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
15: dt + dt { margin-top: 0; }
16: dd dt { margin-top: 0.25em; margin-bottom: 0; }
17: dd p { margin-top: 0; }
18: dd dl + p { margin-top: 1em; }
19: dd table + p { margin-top: 1em; }
20: p + * > li, dd li { margin: 1em 0; }
21: dt, dfn { font-weight: bold; font-style: normal; }
22: dt dfn { font-style: italic; }
23: pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
24: pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
25: pre em { font-weight: bolder; font-style: normal; }
26: @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
27: var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
28: table { border-collapse: collapse; border-style: hidden hidden none hidden; }
29: table thead, table tbody { border-bottom: solid; }
30: table tbody th:first-child { border-left: solid; }
31: table tbody th { text-align: left; }
32: table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
33: blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
34:
35: .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
36: .matrix, .matrix td { border: none; text-align: right; }
37: .matrix { margin-left: 2em; }
38: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
39: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
40: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
41:
42: .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
43: img.extra { float: right; }
44: pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; }
45: pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
46: pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
47: pre.css:first-line { color: #AAAA50; }
48: dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
49: hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
50: dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
51: dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
52: dl.domintro dd p { margin: 0.5em 0; }
53: dl.switch { padding-left: 2em; }
54: dl.switch > dt { text-indent: -1.5em; }
55: dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
56: dl.triple { padding: 0 0 0 1em; }
57: dl.triple dt, dl.triple dd { margin: 0; display: inline }
58: dl.triple dt:after { content: ':'; }
59: dl.triple dd:after { content: '\A'; white-space: pre; }
60: .diff-old { text-decoration: line-through; color: silver; background: transparent; }
61: .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
62: a .diff-new { border-bottom: 1px blue solid; }
63:
64: h2 { page-break-before: always; }
65: h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
66: h1 + h2, hr + h2.no-toc { page-break-before: auto; }
67:
68: p > span:not([title=""]):not([class="XXX"]):not([class="impl"]), li > span:not([title=""]):not([class="XXX"]):not([class="impl"]) { border-bottom: solid #9999CC; }
69:
70: div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
71: div.head p { margin: 0; }
72: div.head h1 { margin: 0; }
73: div.head .logo { float: right; margin: 0 1em; }
74: div.head .logo img { border: none } /* remove border from top image */
75: div.head dl { margin: 1em 0; }
76: div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
77:
78: body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
79: body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
80: body > .toc > li > * { margin-bottom: 0.5em; }
81: body > .toc > li > * > li > * { margin-bottom: 0.25em; }
82: .toc, .toc li { list-style: none; }
83:
84: .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
85: .brief li { margin: 0; padding: 0; }
86: .brief li p { margin: 0; padding: 0; }
87:
88: .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
89: .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
90: .category-list li { display: inline; }
91: .category-list li:not(:last-child)::after { content: ', '; }
92: .category-list li > span, .category-list li > a { text-transform: lowercase; }
93: .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
94:
95: .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
96: .XXX > :first-child { margin-top: 0; }
97: p .XXX { line-height: 3em; }
98: .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
99: .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
100: .annotation :link, .annotation :visited { color: inherit; }
101: .annotation :link:hover, .annotation :visited:hover { background: transparent; }
102: .annotation span { border: none ! important; }
103: .note { color: green; background: transparent; font-family: sans-serif; }
104: .warning { color: red; background: transparent; }
105: .note, .warning { font-weight: bolder; font-style: italic; }
106: p.note, div.note { padding: 0.5em 2em; }
107: span.note { padding: 0 2em; }
108: .note p:first-child, .warning p:first-child { margin-top: 0; }
109: .note p:last-child, .warning p:last-child { margin-bottom: 0; }
110: .warning:before { font-style: normal; }
111: p.note:before { content: 'Note: '; }
112: p.warning:before { content: '\26A0 Warning! '; }
113:
114: .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
115: .bookkeeping { font-size: 0.8em; margin: 2em 0; }
116: .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
117:
118: h4 { position: relative; z-index: 3; }
119: h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
120: .element {
121: background: #EEEEFF;
122: color: black;
123: margin: 0 0 1em 0.15em;
124: padding: 0 1em 0.25em 0.75em;
125: border-left: solid #9999FF 0.25em;
126: position: relative;
127: z-index: 1;
128: }
129: .element:before {
130: position: absolute;
131: z-index: 2;
132: top: 0;
133: left: -1.15em;
134: height: 2em;
135: width: 0.9em;
136: background: #EEEEFF;
137: content: ' ';
138: border-style: none none solid solid;
139: border-color: #9999FF;
140: border-width: 0.25em;
141: }
142:
143: .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
144: td > .example:only-child { margin: 0 0 0 0.1em; }
145:
146: ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
147: ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
148: ul.domTree li li { list-style: none; }
149: 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; }
150: 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; }
151: ul.domTree span { font-style: italic; font-family: serif; }
152: ul.domTree .t1 code { color: purple; font-weight: bold; }
153: ul.domTree .t2 { font-style: normal; font-family: monospace; }
154: ul.domTree .t2 .name { color: black; font-weight: bold; }
155: ul.domTree .t2 .value { color: blue; font-weight: normal; }
156: ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
157: ul.domTree .t7 code, .domTree .t8 code { color: green; }
158: ul.domTree .t10 code { color: teal; }
159:
160: body.dfnEnabled dfn { cursor: pointer; }
161: .dfnPanel {
162: display: inline;
163: position: absolute;
164: z-index: 10;
165: height: auto;
166: width: auto;
167: padding: 0.5em 0.75em;
168: font: small sans-serif, Droid Sans Fallback;
169: background: #DDDDDD;
170: color: black;
171: border: outset 0.2em;
172: }
173: .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
174: .dfnPanel :link, .dfnPanel :visited { color: black; }
175: .dfnPanel p { font-weight: bolder; }
176: .dfnPanel * + p { margin-top: 0.25em; }
177: .dfnPanel li { list-style-position: inside; }
178:
179: #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
180: #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
181: #configUI p label { display: block; }
182: #configUI #updateUI, #configUI .loginUI { text-align: center; }
183: #configUI input[type=button] { display: block; margin: auto; }
184: </style><style type="text/css">
185:
186: .applies thead th > * { display: block; }
187: .applies thead code { display: block; }
188: .applies tbody th { whitespace: nowrap; }
189: .applies td { text-align: center; }
190: .applies .yes { background: yellow; }
191:
192: .matrix, .matrix td { border: none; text-align: right; }
193: .matrix { margin-left: 2em; }
194:
195: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
196: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
197: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
198:
199: #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
200: #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
201: #table-example-1 caption { padding-bottom: 0.5em; }
202: #table-example-1 thead, #table-example-1 tbody { border: none; }
203: #table-example-1 th, #table-example-1 td { border: solid thin; }
204: #table-example-1 th { font-weight: normal; }
205: #table-example-1 td { border-style: none solid; vertical-align: top; }
206: #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
207: #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
208: #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
209: #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
210: #table-example-1 tbody td:first-child::after { content: leader(". "); }
211: #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
212: #table-example-1 tbody td:first-child + td { width: 10em; }
213: #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
214: #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
215:
216: .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
217: .apple-table-examples * { font-family: "Times", serif; }
218: .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
219: .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
220: .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
221: .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
222: .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
223: .apple-table-examples td { text-align: right; vertical-align: top; }
224: .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
225: .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
226: .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
227: .apple-table-examples sup { line-height: 0; }
228:
229: .details-example img { vertical-align: top; }
230:
231: #named-character-references-table {
232: font-size: 0.6em;
233: column-width: 28em;
234: column-gap: 1em;
235: -moz-column-width: 28em;
236: -moz-column-gap: 1em;
237: -webkit-column-width: 28em;
238: -webkit-column-gap: 1em;
239: }
240: #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
241: #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; }
242:
1.2 mike 243: .glyph.control { color: red; }
244:
1.1 mike 245: </style><style type="text/css">
246: .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; }
247: </style><link href="data:text/css," id="complete" rel="stylesheet" title="Complete specification"><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"><script type="text/javascript">
248: function getCookie(name) {
249: var params = location.search.substr(1).split("&");
250: for (var index = 0; index < params.length; index++) {
251: if (params[index] == name)
252: return "1";
253: var data = params[index].split("=");
254: if (data[0] == name)
255: return unescape(data[1]);
256: }
257: var cookies = document.cookie.split("; ");
258: for (var index = 0; index < cookies.length; index++) {
259: var data = cookies[index].split("=");
260: if (data[0] == name)
261: return unescape(data[1]);
262: }
263: return null;
264: }
265: function load(script) {
266: var e = document.createElement('script');
267: e.setAttribute('src', 'http://www.whatwg.org/specs/web-apps/current-work/' + script + '?' + encodeURIComponent(location) + '&' + encodeURIComponent(document.referrer));
268: document.body.appendChild(e);
269: }
270: function init() {
271: if (location.search == '?slow-browser')
272: return;
273: var configUI = document.createElement('div');
274: configUI.id = 'configUI';
275: document.body.appendChild(configUI);
276: // load('reviewer.js'); // would need cross-site XHR
277: if (document.getElementById('head'))
278: load('toc.js');
279: load('styler.js');
280: // load('updater.js'); // would need cross-site XHR
281: load('dfn.js'); // doesn't support split-out specs, but, oh well.
282: // load('status.js'); // would need cross-site XHR
283: if (getCookie('profile') == '1')
284: document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
285: fixBrokenLink();
286: }
287: </script><link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet" type="text/css">
288: <script src="link-fixup.js"></script>
289: <link href="scripting-1.html" title="4.3 Scripting" rel="prev">
290: <link href="spec.html#contents" title="Table of contents" rel="index">
291: <link href="grouping-content.html" title="4.5 Grouping content" rel="next">
292: </head><body onload="fixBrokenLink(); init()"><div class="head" id="head">
293: <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
1.3 ! mike 294:
1.1 mike 295: <h1>HTML5</h1>
296: </div><div>
297: <a href="scripting-1.html">← 4.3 Scripting</a> –
298: <a href="spec.html#contents">Table of contents</a> –
299: <a href="grouping-content.html">4.5 Grouping content →</a>
300: <ol class="toc"><li><ol><li><a href="sections.html#sections"><span class="secno">4.4 </span>Sections</a>
301: <ol><li><a href="sections.html#the-body-element-0"><span class="secno">4.4.1 </span>The <code>body</code> element</a></li><li><a href="sections.html#the-section-element"><span class="secno">4.4.2 </span>The <code>section</code> element</a></li><li><a href="sections.html#the-nav-element"><span class="secno">4.4.3 </span>The <code>nav</code> element</a></li><li><a href="sections.html#the-article-element"><span class="secno">4.4.4 </span>The <code>article</code> element</a></li><li><a href="sections.html#the-aside-element"><span class="secno">4.4.5 </span>The <code>aside</code> element</a></li><li><a href="sections.html#the-h1-h2-h3-h4-h5-and-h6-elements"><span class="secno">4.4.6 </span>The <code>h1</code>, <code>h2</code>,
302: <code>h3</code>, <code>h4</code>,
303: <code>h5</code>, and <code>h6</code>
304: elements</a></li><li><a href="sections.html#the-hgroup-element"><span class="secno">4.4.7 </span>The <code>hgroup</code> element</a></li><li><a href="sections.html#the-header-element"><span class="secno">4.4.8 </span>The <code>header</code> element</a></li><li><a href="sections.html#the-footer-element"><span class="secno">4.4.9 </span>The <code>footer</code> element</a></li><li><a href="sections.html#the-address-element"><span class="secno">4.4.10 </span>The <code>address</code> element</a></li><li><a href="sections.html#headings-and-sections"><span class="secno">4.4.11 </span>Headings and sections</a>
305: <ol><li><a href="sections.html#outlines"><span class="secno">4.4.11.1 </span>Creating an outline</a></li></ol></li></ol></li></ol></li></ol></div>
306:
307: <h3 id="sections"><span class="secno">4.4 </span>Sections</h3><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><h4 id="the-body-element-0"><span class="secno">4.4.1 </span>The <dfn><code>body</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
308: <dd><a href="#sectioning-root">Sectioning root</a>.</dd>
309: <dt>Contexts in which this element may be used:</dt>
310: <dd>As the second element in an <code><a href="semantics.html#the-html-element-0">html</a></code> element.</dd>
311: <dt>Content model:</dt>
312: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
313: <dt>Content attributes:</dt>
314: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
315: <dd><code title="handler-window-onafterprint"><a href="webappapis.html#handler-window-onafterprint">onafterprint</a></code></dd>
316: <dd><code title="handler-window-onbeforeprint"><a href="webappapis.html#handler-window-onbeforeprint">onbeforeprint</a></code></dd>
317: <dd><code title="handler-window-onbeforeunload"><a href="webappapis.html#handler-window-onbeforeunload">onbeforeunload</a></code></dd>
318: <dd><code title="handler-window-onblur"><a href="webappapis.html#handler-window-onblur">onblur</a></code></dd>
319: <dd><code title="handler-window-onerror"><a href="webappapis.html#handler-window-onerror">onerror</a></code></dd>
320: <dd><code title="handler-window-onfocus"><a href="webappapis.html#handler-window-onfocus">onfocus</a></code></dd>
321: <dd><code title="handler-window-onhashchange"><a href="webappapis.html#handler-window-onhashchange">onhashchange</a></code></dd>
322: <dd><code title="handler-window-onload"><a href="webappapis.html#handler-window-onload">onload</a></code></dd>
323: <dd><code title="handler-window-onmessage"><a href="webappapis.html#handler-window-onmessage">onmessage</a></code></dd>
324: <dd><code title="handler-window-onoffline"><a href="webappapis.html#handler-window-onoffline">onoffline</a></code></dd>
325: <dd><code title="handler-window-ononline"><a href="webappapis.html#handler-window-ononline">ononline</a></code></dd>
326: <dd><code title="handler-window-onpagehide"><a href="webappapis.html#handler-window-onpagehide">onpagehide</a></code></dd>
327: <dd><code title="handler-window-onpageshow"><a href="webappapis.html#handler-window-onpageshow">onpageshow</a></code></dd>
328: <dd><code title="handler-window-onpopstate"><a href="webappapis.html#handler-window-onpopstate">onpopstate</a></code></dd>
329: <dd><code title="handler-window-onredo"><a href="webappapis.html#handler-window-onredo">onredo</a></code></dd>
330: <dd><code title="handler-window-onresize"><a href="webappapis.html#handler-window-onresize">onresize</a></code></dd>
331: <dd><code title="handler-window-onstorage"><a href="webappapis.html#handler-window-onstorage">onstorage</a></code></dd>
332: <dd><code title="handler-window-onundo"><a href="webappapis.html#handler-window-onundo">onundo</a></code></dd>
333: <dd><code title="handler-window-onunload"><a href="webappapis.html#handler-window-onunload">onunload</a></code></dd>
334: <dt>DOM interface:</dt>
335: <dd>
336: <pre class="idl">interface <dfn id="htmlbodyelement">HTMLBodyElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
337: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onafterprint" title="handler-window-onafterprint">onafterprint</a>;
338: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onbeforeprint" title="handler-window-onbeforeprint">onbeforeprint</a>;
339: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onbeforeunload" title="handler-window-onbeforeunload">onbeforeunload</a>;
340: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onblur" title="handler-window-onblur">onblur</a>;
341: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onerror" title="handler-window-onerror">onerror</a>;
342: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onfocus" title="handler-window-onfocus">onfocus</a>;
343: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onhashchange" title="handler-window-onhashchange">onhashchange</a>;
344: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onload" title="handler-window-onload">onload</a>;
345: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onmessage" title="handler-window-onmessage">onmessage</a>;
346: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onoffline" title="handler-window-onoffline">onoffline</a>;
347: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-ononline" title="handler-window-ononline">ononline</a>;
348: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onpopstate" title="handler-window-onpopstate">onpopstate</a>;
349: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onpagehide" title="handler-window-onpagehide">onpagehide</a>;
350: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onpageshow" title="handler-window-onpageshow">onpageshow</a>;
351: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onredo" title="handler-window-onredo">onredo</a>;
352: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onresize" title="handler-window-onresize">onresize</a>;
353: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onstorage" title="handler-window-onstorage">onstorage</a>;
354: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onundo" title="handler-window-onundo">onundo</a>;
355: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onunload" title="handler-window-onunload">onunload</a>;
356: };</pre>
357: </dd>
358: </dl><p>The <code><a href="#the-body-element-0">body</a></code> element <a href="rendering.html#represents">represents</a> the main
359: content of the document.</p><p>In conforming documents, there is only one <code><a href="#the-body-element-0">body</a></code>
360: element. The <code title="dom-document-body"><a href="dom.html#dom-document-body">document.body</a></code>
361: IDL attribute provides scripts with easy access to a document's
362: <code><a href="#the-body-element-0">body</a></code> element.</p><div class="impl">
363:
364: <p class="note">Some DOM operations (for example, parts of the
365: <a href="dnd.html#dnd">drag and drop</a> model) are defined in terms of "<a href="dom.html#the-body-element">the
366: body element</a>". This refers to a particular element in the
367: DOM, as per the definition of the term, and not any arbitrary
368: <code><a href="#the-body-element-0">body</a></code> element.</p>
369:
370: </div><p>The <code><a href="#the-body-element-0">body</a></code> element exposes as <a href="webappapis.html#event-handler-content-attributes">event handler
371: content attributes</a> a number of the <a href="webappapis.html#event-handlers">event
372: handlers</a> of the <code><a href="browsers.html#window">Window</a></code> object. It also mirrors
373: their <a href="webappapis.html#event-handler-idl-attributes">event handler IDL attributes</a>.</p><p>The <code title="handler-window-onblur"><a href="webappapis.html#handler-window-onblur">onblur</a></code>, <code title="handler-window-onerror"><a href="webappapis.html#handler-window-onerror">onerror</a></code>, <code title="handler-window-onfocus"><a href="webappapis.html#handler-window-onfocus">onfocus</a></code>, and <code title="handler-window-onload"><a href="webappapis.html#handler-window-onload">onload</a></code> <a href="webappapis.html#event-handlers">event
374: handlers</a> of the <code><a href="browsers.html#window">Window</a></code> object, exposed on the
375: <code><a href="#the-body-element-0">body</a></code> element, shadow the generic <a href="webappapis.html#event-handlers">event
376: handlers</a> with the same names normally supported by <a href="infrastructure.html#html-elements">HTML
377: elements</a>.</p><p class="example">Thus, for example, a bubbling <code title="event-error">error</code> event fired on a child of <a href="dom.html#the-body-element">the
378: body element</a> of a <code><a href="infrastructure.html#document">Document</a></code> would first trigger
379: the <code title="handler-onerror"><a href="webappapis.html#handler-onerror">onerror</a></code> <a href="webappapis.html#event-handler-content-attributes">event handler
380: content attributes</a> of that element, then that of the root
381: <code><a href="semantics.html#the-html-element-0">html</a></code> element, and only <em>then</em> would it trigger
382: the <code title="handler-window-onerror"><a href="webappapis.html#handler-window-onerror">onerror</a></code> <a href="webappapis.html#event-handler-content-attributes" title="event handler content attributes">event handler content
383: attribute</a> on the <code><a href="#the-body-element-0">body</a></code> element. This is because
384: the event would bubble from the target, to the <code><a href="#the-body-element-0">body</a></code>, to
385: the <code><a href="semantics.html#the-html-element-0">html</a></code>, to the <code><a href="infrastructure.html#document">Document</a></code>, to the
386: <code><a href="browsers.html#window">Window</a></code>, and the <a href="webappapis.html#event-handlers" title="event handlers">event
387: handler</a> on the <code><a href="#the-body-element-0">body</a></code> is watching the
388: <code><a href="browsers.html#window">Window</a></code> not the <code><a href="#the-body-element-0">body</a></code>. A regular event
389: listener attached to the <code><a href="#the-body-element-0">body</a></code> using <code title="">addEventListener()</code>, however, would fire when the
390: event bubbled through the <code><a href="#the-body-element-0">body</a></code> and not when it reaches
391: the <code><a href="browsers.html#window">Window</a></code> object.</p><div class="example">
392:
393: <p>This page updates an indicator to show whether or not the user
394: is online:</p>
395:
396: <pre><!DOCTYPE HTML>
397: <html>
398: <head>
399: <title>Online or offline?</title>
400: <script>
401: function update(online) {
402: document.getElementById('status').textContent =
403: online ? 'Online' : 'Offline';
404: }
405: </script>
406: </head>
407: <body ononline="update(true)"
408: onoffline="update(false)"
409: onload="update(navigator.onLine)">
410: <p>You are: <span id="status">(Unknown)</span></p>
411: </body>
412: </html></pre>
413:
414: </div><h4 id="the-section-element"><span class="secno">4.4.2 </span>The <dfn><code>section</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
415: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
416: <dd><a href="content-models.html#sectioning-content">Sectioning content</a>.</dd>
417: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
418: <dt>Contexts in which this element may be used:</dt>
419: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
420: <dt>Content model:</dt>
421: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
422: <dt>Content attributes:</dt>
423: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
424: <dt>DOM interface:</dt>
425: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
426: </dl><p>The <code><a href="#the-section-element">section</a></code> element <a href="rendering.html#represents">represents</a> a
427: generic section of a document or application. A section, in this
428: context, is a thematic grouping of content, typically with a
429: heading.</p><p class="example">Examples of sections would be chapters, the
430: various tabbed pages in a tabbed dialog box, or the numbered
431: sections of a thesis. A Web site's home page could be split into
432: sections for an introduction, news items, contact information.</p><p class="note">Authors are encouraged to use the
433: <code><a href="#the-article-element">article</a></code> element instead of the <code><a href="#the-section-element">section</a></code>
434: element when it would make sense to syndicate the contents of the
435: element.</p><p class="note" id="use-div-for-wrappers">The <code><a href="#the-section-element">section</a></code>
436: element is not a generic container element. When an element is
437: needed for styling purposes or as a convenience for scripting,
438: authors are encouraged to use the <code><a href="grouping-content.html#the-div-element">div</a></code> element
439: instead. A general rule is that the <code><a href="#the-section-element">section</a></code> element is
440: appropriate only if the element's contents would be listed
441: explicitly in the document's <a href="#outline">outline</a>.</p><div class="example">
442:
443: <p>In the following example, we see an article (part of a larger
444: Web page) about apples, containing two short sections.</p>
445:
446: <pre><article>
447: <hgroup>
448: <h1>Apples</h1>
449: <h2>Tasty, delicious fruit!</h2>
450: </hgroup>
451: <p>The apple is the pomaceous fruit of the apple tree.</p>
452: <section>
453: <h1>Red Delicious</h1>
454: <p>These bright red apples are the most common found in many
455: supermarkets.</p>
456: </section>
457: <section>
458: <h1>Granny Smith</h1>
459: <p>These juicy, green apples make a great filling for
460: apple pies.</p>
461: </section>
462: </article></pre>
463:
464: <p>Notice how the use of <code><a href="#the-section-element">section</a></code> means that the author
465: can use <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code> elements throughout, without having to
466: worry about whether a particular section is at the top level, the
467: second level, the third level, and so on.</p>
468:
469: </div><div class="example">
470:
471: <p>Here is a graduation programme with two sections, one for the
472: list of people graduating, and one for the description of the
473: ceremony.</p>
474:
475: <pre><!DOCTYPE Html>
476: <Html
477: ><Head
478: ><Title
479: >Graduation Ceremony Summer 2022</Title
480: ></Head
481: ><Body
482: ><H1
483: >Graduation</H1
484: ><Section
485: ><H1
486: >Ceremony</H1
487: ><P
488: >Opening Procession</P
489: ><P
490: >Speech by Validactorian</P
491: ><P
492: >Speech by Class President</P
493: ><P
494: >Presentation of Diplomas</P
495: ><P
496: >Closing Speech by Headmaster</P
497: ></Section
498: ><Section
499: ><H1
500: >Graduates</H1
501: ><Ul
502: ><Li
503: >Molly Carpenter</Li
504: ><Li
505: >Anastasia Luccio</Li
506: ><Li
507: >Ebenezar McCoy</Li
508: ><Li
509: >Karrin Murphy</Li
510: ><Li
511: >Thomas Raith</Li
512: ><Li
513: >Susan Rodriguez</Li
514: ></Ul
515: ></Section
516: ></Body
517: ></Html></pre>
518:
519: </div><h4 id="the-nav-element"><span class="secno">4.4.3 </span>The <dfn><code>nav</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
520: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
521: <dd><a href="content-models.html#sectioning-content">Sectioning content</a>.</dd>
522: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
523: <dt>Contexts in which this element may be used:</dt>
524: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
525: <dt>Content model:</dt>
526: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
527: <dt>Content attributes:</dt>
528: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
529: <dt>DOM interface:</dt>
530: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
531: </dl><p>The <code><a href="#the-nav-element">nav</a></code> element <a href="rendering.html#represents">represents</a> a section of
532: a page that links to other pages or to parts within the page: a
533: section with navigation links.</p><p>Not all groups of links on a page need to be in a
534: <code><a href="#the-nav-element">nav</a></code> element — only sections that consist of major
535: navigation blocks are appropriate for the <code><a href="#the-nav-element">nav</a></code>
536: element. In particular, it is common for footers to have a short
537: list of links to various pages of a site, such as the terms of
538: service, the home page, and a copyright page. The
539: <code><a href="#the-footer-element">footer</a></code> element alone is sufficient for such cases,
540: without a <code><a href="#the-nav-element">nav</a></code> element.</p><p class="note">User agents (such as screen readers) that are
541: targeted at users who can benefit from navigation information being
542: omitted in the initial rendering, or who can benefit from navigation
543: information being immediately available, can use this element as a
544: way to determine what content on the page to initially skip and/or
545: provide on request.</p><div class="example">
546:
547: <p>In the following example, the page has several places where
548: links are present, but only one of those places is considered a
549: navigation section.</p>
550:
551: <pre><body>
552: <header>
553: <h1>Wake up sheeple!</h1>
554: <p><a href="news.html">News</a> -
555: <a href="blog.html">Blog</a> -
556: <a href="forums.html">Forums</a></p>
557: <p>Last Modified: <time>2009-04-01</time></p>
558: <nav>
559: <h1>Navigation</h1>
560: <ul>
561: <li><a href="articles.html">Index of all articles</a></li>
562: <li><a href="today.html">Things sheeple need to wake up for today</a></li>
563: <li><a href="successes.html">Sheeple we have managed to wake</a></li>
564: </ul>
565: </nav>
566: </header>
567: <div>
568: <article>
569: <header>
570: <h1>My Day at the Beach</h1>
571: </header>
572: <div>
573: <p>Today I went to the beach and had a lot of fun.</p>
574: <em>...more content...</em>
575: </div>
576: <footer>
577: <p>Posted <time pubdate datetime="2009-10-10T14:36-08:00">Thursday</time>.</p>
578: </footer>
579: </article>
580: <em>...more blog posts...</em>
581: </div>
582: <footer>
583: <p>Copyright © 2006 The Example Company</p>
584: <p><a href="about.html">About</a> -
585: <a href="policy.html">Privacy Policy</a> -
586: <a href="contact.html">Contact Us</a></p>
587: </footer>
588: </body></pre>
589:
590: <p>Notice the <code><a href="grouping-content.html#the-div-element">div</a></code> elements being used to wrap all the
591: contents of the page other than the header and footer, and all the
592: contents of the blog entry other than its header and footer.</p>
593:
594: </div><div class="example">
595:
596: <p>In the following example, there are two <code><a href="#the-nav-element">nav</a></code>
597: elements, one for primary navigation around the site, and one for
598: secondary navigation around the page itself.</p>
599:
600: <pre><body>
601: <h1>The Wiki Center Of Exampland</h1>
602: <nav>
603: <ul>
604: <li><a href="/">Home</a></li>
605: <li><a href="/events">Current Events</a></li>
606: <em>...more...</em>
607: </ul>
608: </nav>
609: <article>
610: <header>
611: <h1>Demos in Exampland</h1>
612: <p>Written by A. N. Other.</p>
613: </header>
614: <nav>
615: <ul>
616: <li><a href="#public">Public demonstrations</a></li>
617: <li><a href="#destroy">Demolitions</a></li>
618: <em>...more...</em>
619: </ul>
620: </nav>
621: <div>
622: <section id="public">
623: <h1>Public demonstrations</h1>
624: <p><em>...more...</em></p>
625: </section>
626: <section id="destroy">
627: <h1>Demolitions</h1>
628: <p><em>...more...</em></p>
629: </section>
630: <em>...more...</em>
631: </div>
632: <footer>
633: <p><a href="?edit">Edit</a> | <a href="?delete">Delete</a> | <a href="?Rename">Rename</a></p>
634: </footer>
635: </article>
636: <footer>
637: <p><small>© copyright 1998 Exampland Emperor</small></p>
638: </footer>
639: </body></pre>
640:
641: </div><h4 id="the-article-element"><span class="secno">4.4.4 </span>The <dfn><code>article</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
642: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
643: <dd><a href="content-models.html#sectioning-content">Sectioning content</a>.</dd>
644: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
645: <dt>Contexts in which this element may be used:</dt>
646: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
647: <dt>Content model:</dt>
648: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
649: <dt>Content attributes:</dt>
650: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
651: <dt>DOM interface:</dt>
652: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
653: </dl><p>The <code><a href="#the-article-element">article</a></code> element <a href="rendering.html#represents">represents</a> a
654: self-contained composition in a document, page, application, or site
655: and that is intended to be independently distributable or reusable,
656: e.g. in syndication. This could be a forum post, a magazine or
657: newspaper article, a blog entry, a user-submitted comment, an
658: interactive widget or gadget, or any other independent item of
659: content.</p><p>When <code><a href="#the-article-element">article</a></code> elements are nested, the inner
660: <code><a href="#the-article-element">article</a></code> elements represent articles that are in
661: principle related to the contents of the outer article. For
662: instance, a blog entry on a site that accepts user-submitted
663: comments could represent the comments as <code><a href="#the-article-element">article</a></code>
664: elements nested within the <code><a href="#the-article-element">article</a></code> element for the blog
665: entry.</p><p>Author information associated with an <code><a href="#the-article-element">article</a></code>
666: element (q.v. the <code><a href="#the-address-element">address</a></code> element) does not apply to
667: nested <code><a href="#the-article-element">article</a></code> elements.</p><p class="note">When used specifically with content to be
668: redistributed in syndication, the <code><a href="#the-article-element">article</a></code> element is
669: similar in purpose to the <code title="">entry</code> element in
670: Atom. <a href="references.html#refsATOM">[ATOM]</a>
671:
672: </p><p class="note">The <code><a href="text-level-semantics.html#the-time-element">time</a></code> element's <code title="attr-time-pubdate"><a href="text-level-semantics.html#attr-time-pubdate">pubdate</a></code> attribute can be used to
673: provide the publication date for an <code><a href="#the-article-element">article</a></code>
674: element.</p><div class="example" id="article-example">
675:
676: <p>This example shows a blog post using the <code><a href="#the-article-element">article</a></code>
677: element:</p>
678:
679: <pre><article>
680: <header>
681: <h1>The Very First Rule of Life</h1>
682: <p><time pubdate datetime="2009-10-09T14:28-08:00"></time></p>
683: </header>
684: <p>If there's a microphone anywhere near you, assume it's hot and
685: sending whatever you're saying to the world. Seriously.</p>
686: <p><em>...</em></p>
687: <footer>
688: <a href="?comments=1">Show comments...</a>
689: </footer>
690: </article></pre>
691:
692: <p>Here is that same blog post, but showing some of the comments:</p>
693:
694: <pre><article>
695: <header>
696: <h1>The Very First Rule of Life</h1>
697: <p><time pubdate datetime="2009-10-09T14:28-08:00"></time></p>
698: </header>
699: <p>If there's a microphone anywhere near you, assume it's hot and
700: sending whatever you're saying to the world. Seriously.</p>
701: <p><em>...</em></p>
702: <section>
703: <h1>Comments</h1>
704: <article>
705: <footer>
706: <p>Posted by: George Washington</p>
707: <p><time pubdate datetime="2009-10-10T19:10-08:00"></time></p>
708: </footer>
709: <p>Yeah! Especially when talking about your lobbyist friends!</p>
710: </article>
711: <article>
712: <footer>
713: <p>Posted by: George Hammond</p>
714: <p><time pubdate datetime="2009-10-10T19:15-08:00"></time></p>
715: </footer>
716: <p>Hey, you have the same first name as me.</p>
717: </article>
718: </section>
719: </article></pre>
720:
721: <p>Notice the use of <code><a href="#the-footer-element">footer</a></code> to give the information
722: each comment (such as who wrote it and when): the
723: <code><a href="#the-footer-element">footer</a></code> element <em>can</em> appear at the start of its
724: section when appropriate, such as in this case. (Using
725: <code><a href="#the-header-element">header</a></code> in this case wouldn't be wrong either; it's
726: mostly a matter of authoring preference.)</p>
727:
728: </div><h4 id="the-aside-element"><span class="secno">4.4.5 </span>The <dfn><code>aside</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments. </i><span><a href="http://www.w3.org/html/wg/tracker/issues/91">ISSUE-91</a> (aside) blocks progress to Last Call</span></p><dl class="element"><dt>Categories</dt>
729: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
730: <dd><a href="content-models.html#sectioning-content">Sectioning content</a>.</dd>
731: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
732: <dt>Contexts in which this element may be used:</dt>
733: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
734: <dt>Content model:</dt>
735: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
736: <dt>Content attributes:</dt>
737: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
738: <dt>DOM interface:</dt>
739: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
740: </dl><p>The <code><a href="#the-aside-element">aside</a></code> element <a href="rendering.html#represents">represents</a> a section
741: of a page that consists of content that is tangentially related to
742: the content around the <code><a href="#the-aside-element">aside</a></code> element, and which could
743: be considered separate from that content. Such sections are often
744: represented as sidebars in printed typography.</p><p>The element can be used for typographical effects like pull
745: quotes or sidebars, for advertising, for groups of <code><a href="#the-nav-element">nav</a></code>
746: elements, and for other content that is considered separate from the
747: 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>
748: element just for parentheticals, since those are part of the main
749: flow of the document.</p><div class="example">
750:
751: <p>The following example shows how an aside is used to mark up
752: background material on Switzerland in a much longer news story on
753: Europe.</p>
754:
755: <pre><aside>
756: <h1>Switzerland</h1>
757: <p>Switzerland, a land-locked country in the middle of geographic
758: Europe, has not joined the geopolitical European Union, though it is
759: a signatory to a number of European treaties.</p>
760: </aside></pre>
761:
762: </div><div class="example">
763:
764: <p>The following example shows how an aside is used to mark up
765: a pull quote in a longer article.</p>
766:
767: <pre>...
768:
769: <p>He later joined a large company, continuing on the same work.
770: <q>I love my job. People ask me what I do for fun when I'm not at
771: work. But I'm paid to do my hobby, so I never know what to
772: answer. Some people wonder what they would do if they didn't have to
773: work... but I know what I would do, because I was unemployed for a
774: year, and I filled that time doing exactly what I do now.</q></p>
775:
776: <aside>
777: <q> People ask me what I do for fun when I'm not at work. But I'm
778: paid to do my hobby, so I never know what to answer. </q>
779: </aside>
780:
781: <p>Of course his work — or should that be hobby? —
782: isn't his only passion. He also enjoys other pleasures.</p>
783:
784: ...</pre>
785:
786: </div><div class="example">
787:
788: <p>The following extract shows how <code><a href="#the-aside-element">aside</a></code> can be used
789: for blogrolls and other side content on a blog:</p>
790:
791: <pre><body>
792: <header>
793: <h1>My wonderful blog</h1>
794: <p>My tagline</p>
795: </header>
796: <aside>
797: <!-- <em>this aside contains two sections that are tangentially related
798: to the page, namely, links to other blogs, and links to blog posts
799: from this blog</em> -->
800: <nav>
801: <h1>My blogroll</h1>
802: <ul>
803: <li><a href="http://blog.example.com/">Example Blog</a>
804: </ul>
805: </nav>
806: <nav>
807: <h1>Archives</h1>
808: <ol reversed>
809: <li><a href="/last-post">My last post</a>
810: <li><a href="/first-post">My first post</a>
811: </ol>
812: </nav>
813: </aside>
814: <aside>
815: <!-- <em>this aside is tangentially related to the page also, it
816: contains twitter messages from the blog author</em> -->
817: <h1>Twitter Feed</h1>
818: <blockquote cite="http://twitter.example.net/t31351234">
819: I'm on vacation, writing my blog.
820: </blockquote>
821: <blockquote cite="http://twitter.example.net/t31219752">
822: I'm going to go on vacation soon.
823: </blockquote>
824: </aside>
825: <article>
826: <!-- <em>this is a blog post</em> -->
827: <h1>My last post</h1>
828: <p>This is my last post.</p>
829: <footer>
830: <p><a href="/last-post" rel=bookmark>Permalink</a>
831: </footer>
832: </article>
833: <article>
834: <!-- <em>this is also a blog post</em> -->
835: <h1>My first post</h1>
836: <p>This is my first post.</p>
837: <aside>
838: <!-- <em>this aside is about the blog post, since it's inside the
839: <article> element; it would be wrong, for instance, to put the
840: blogroll here, since the blogroll isn't really related to this post
841: specifically, only to the page as a whole</em> -->
842: <h1>Posting</h1>
843: <p>While I'm thinking about it, I wanted to say something about
844: posting. Posting is fun!</p>
845: </aside>
846: <footer>
847: <p><a href="/first-post" rel=bookmark>Permalink</a>
848: </footer>
849: </article>
850: <footer>
851: <nav>
852: <a href="/archives">Archives</a> —
853: <a href="/about">About me</a> —
854: <a href="/copyright">Copyright</a>
855: </nav>
856: </footer>
857: </body></pre>
858:
859: </div><h4 id="the-h1-h2-h3-h4-h5-and-h6-elements"><span class="secno">4.4.6 </span>The <dfn><code>h1</code></dfn>, <dfn><code>h2</code></dfn>,
860: <dfn><code>h3</code></dfn>, <dfn><code>h4</code></dfn>,
861: <dfn><code>h5</code></dfn>, and <dfn><code>h6</code></dfn>
862: elements</h4><dl class="element"><dt>Categories</dt>
863: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
864: <dd><a href="content-models.html#heading-content">Heading content</a>.</dd>
865: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
866: <dt>Contexts in which this element may be used:</dt>
867: <dd>As a child of an <code><a href="#the-hgroup-element">hgroup</a></code> element.</dd>
868: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
869: <dt>Content model:</dt>
870: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
871: <dt>Content attributes:</dt>
872: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
873: <dt>DOM interface:</dt>
874: <dd>
875: <pre class="idl">interface <dfn id="htmlheadingelement">HTMLHeadingElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {};</pre>
876: </dd>
877: </dl><p>These elements <a href="rendering.html#represents" title="represents">represent</a> headings
878: for their sections.</p><p>The semantics and meaning of these elements are defined in the
879: 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
880: 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
881: rank, the <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element has the lowest rank, and two
882: elements with the same name have equal rank.</p><div class="example">
883:
884: <p>These two snippets are equivalent:</p>
885:
886: <pre><body>
887: <h1>Let's call it a draw(ing surface)</h1>
888: <h2>Diving in</h2>
889: <h2>Simple shapes</h2>
890: <h2>Canvas coordinates</h2>
891: <h3>Canvas coordinates diagram</h3>
892: <h2>Paths</h2>
893: </body></pre>
894:
895: <pre><body>
896: <h1>Let's call it a draw(ing surface)</h1>
897: <section>
898: <h1>Diving in</h1>
899: </section>
900: <section>
901: <h1>Simple shapes</h1>
902: </section>
903: <section>
904: <h1>Canvas coordinates</h1>
905: <section>
906: <h1>Canvas coordinates diagram</h1>
907: </section>
908: </section>
909: <section>
910: <h1>Paths</h1>
911: </section>
912: </body></pre>
913:
914: </div><h4 id="the-hgroup-element"><span class="secno">4.4.7 </span>The <dfn><code>hgroup</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
915: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
916: <dd><a href="content-models.html#heading-content">Heading content</a>.</dd>
917: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
918: <dt>Contexts in which this element may be used:</dt>
919: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
920: <dt>Content model:</dt>
921: <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>, and/or <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> elements.</dd>
922: <dt>Content attributes:</dt>
923: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
924: <dt>DOM interface:</dt>
925: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
926: </dl><p>The <code><a href="#the-hgroup-element">hgroup</a></code> element <a href="rendering.html#represents">represents</a> the
927: heading of a section. The element is used to group a set of
928: <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">h6</a></code> elements when the heading has
929: multiple levels, such as subheadings, alternative titles, or
930: taglines.</p><p>For the purposes of document summaries, outlines, and the like,
931: the text of <code><a href="#the-hgroup-element">hgroup</a></code> elements is defined to be the text
932: of the highest <a href="#rank" title="rank">ranked</a>
933: <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">h6</a></code> element descendant of the
934: <code><a href="#the-hgroup-element">hgroup</a></code> element, if there are any such elements, and the
935: first such element if there are multiple elements with that
936: <a href="#rank">rank</a>. If there are no such elements, then the text of
937: the <code><a href="#the-hgroup-element">hgroup</a></code> element is the empty string.</p><p>Other elements of <a href="content-models.html#heading-content">heading content</a> in the
938: <code><a href="#the-hgroup-element">hgroup</a></code> element indicate subheadings or subtitles.</p><p>The <a href="#rank">rank</a> of an <code><a href="#the-hgroup-element">hgroup</a></code> element is the
939: rank of the highest-ranked <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">h6</a></code>
940: element descendant of the <code><a href="#the-hgroup-element">hgroup</a></code> element, if there are
941: 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>
942: element (the highest rank).</p><p>The section on <a href="#headings-and-sections">headings and sections</a>
943: defines how <code><a href="#the-hgroup-element">hgroup</a></code> elements are assigned to individual
944: sections.</p><div class="example">
945:
946: <p>Here are some examples of valid headings. In each case, the
947: emphasized text represents the text that would be used as the
948: heading in an application extracting heading data and ignoring
949: subheadings.</p>
950:
951: <pre><hgroup>
952: <h1><strong>The reality dysfunction</strong></h1>
953: <h2>Space is not the only void</h2>
954: </hgroup></pre>
955:
956: <pre><hgroup>
957: <h1><strong>Dr. Strangelove</strong></h1>
958: <h2>Or: How I Learned to Stop Worrying and Love the Bomb</h2>
959: </hgroup></pre>
960:
961: <p>The point of using <code><a href="#the-hgroup-element">hgroup</a></code> in these examples is to
962: mask the <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code> element (which acts as a secondary title)
963: from the <a href="#outline">outline</a> algorithm.</p><!--
964: http://www.brucelawson.co.uk/2009/html-5-is-a-mess/#comment-618895
965: -->
966:
967: </div><h4 id="the-header-element"><span class="secno">4.4.8 </span>The <dfn><code>header</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
968: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
969: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
970: <dt>Contexts in which this element may be used:</dt>
971: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
972: <dt>Content model:</dt>
973: <dd><a href="content-models.html#flow-content">Flow content</a>, but with no <code><a href="#the-header-element">header</a></code> or
974: <code><a href="#the-footer-element">footer</a></code> element descendants.</dd>
975: <dt>Content attributes:</dt>
976: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
977: <dt>DOM interface:</dt>
978: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
979: </dl><p>The <code><a href="#the-header-element">header</a></code> element <a href="rendering.html#represents">represents</a> a group
980: of introductory or navigational aids.</p><p class="note">A <code><a href="#the-header-element">header</a></code> element is intended to usually
981: contain the section's heading (an
982: <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">h6</a></code> element or an
983: <code><a href="#the-hgroup-element">hgroup</a></code> element), but this is not required. The
984: <code><a href="#the-header-element">header</a></code> element can also be used to wrap a section's
985: table of contents, a search form, or any relevant logos.</p><div class="example">
986:
987: <p>Here are some sample headers. This first one is for a game:</p>
988:
989: <pre><header>
990: <p>Welcome to...</p>
991: <h1>Voidwars!</h1>
992: </header></pre>
993:
994: <p>The following snippet shows how the element can be used to mark
995: up a specification's header:</p>
996:
997: <pre><header>
998: <hgroup>
999: <h1>Scalable Vector Graphics (SVG) 1.2</h1>
1000: <h2>W3C Working Draft 27 October 2004</h2>
1001: </hgroup>
1002: <dl>
1003: <dt>This version:</dt>
1004: <dd><a href="http://www.w3.org/TR/2004/WD-SVG12-20041027/">http://www.w3.org/TR/2004/WD-SVG12-20041027/</a></dd>
1005: <dt>Previous version:</dt>
1006: <dd><a href="http://www.w3.org/TR/2004/WD-SVG12-20040510/">http://www.w3.org/TR/2004/WD-SVG12-20040510/</a></dd>
1007: <dt>Latest version of SVG 1.2:</dt>
1008: <dd><a href="http://www.w3.org/TR/SVG12/">http://www.w3.org/TR/SVG12/</a></dd>
1009: <dt>Latest SVG Recommendation:</dt>
1010: <dd><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></dd>
1011: <dt>Editor:</dt>
1012: <dd>Dean Jackson, W3C, <a href="mailto:dean@w3.org">dean@w3.org</a></dd>
1013: <dt>Authors:</dt>
1014: <dd>See <a href="#authors">Author List</a></dd>
1015: </dl>
1016: <p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notic <em>...</em>
1017: </header></pre>
1018:
1019: </div><p class="note">The <code><a href="#the-header-element">header</a></code> element is not
1020: <a href="content-models.html#sectioning-content">sectioning content</a>; it doesn't introduce a new
1021: section.</p><div class="example">
1022:
1023: <p>In this example, the page has a page heading given by the
1024: <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code> element, and two subsections whose headings are
1025: given by <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code> elements. The content after the
1026: <code><a href="#the-header-element">header</a></code> element is still part of the last subsection
1027: started in the <code><a href="#the-header-element">header</a></code> element, because the
1028: <code><a href="#the-header-element">header</a></code> element doesn't take part in the
1029: <a href="#outline">outline</a> algorithm.</p>
1030:
1031: <pre><body>
1032: <header>
1033: <h1>Little Green Guys With Guns</h1>
1034: <nav>
1035: <ul>
1036: <li><a href="/games">Games</a>
1037: <li><a href="/forum">Forum</a>
1038: <li><a href="/download">Download</a>
1039: </ul>
1040: </nav>
1041: <h2>Important News</h2> <!-- this starts a second subsection -->
1042: <!-- this is part of the subsection entitled "Important News" -->
1043: <p>To play today's games you will need to update your client.</p>
1044: <h2>Games</h2> <!-- this starts a third subsection -->
1045: </header>
1046: <p>You have three active games:</p>
1047: <!-- this is still part of the subsection entitled "Games" -->
1048: ...</pre>
1049:
1050: </div><h4 id="the-footer-element"><span class="secno">4.4.9 </span>The <dfn><code>footer</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1051: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
1052: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
1053: <dt>Contexts in which this element may be used:</dt>
1054: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
1055: <dt>Content model:</dt>
1056: <dd><a href="content-models.html#flow-content">Flow content</a>, but with no <code><a href="#the-header-element">header</a></code> or
1057: <code><a href="#the-footer-element">footer</a></code> element descendants.</dd>
1058: <dt>Content attributes:</dt>
1059: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
1060: <dt>DOM interface:</dt>
1061: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
1062: </dl><p>The <code><a href="#the-footer-element">footer</a></code> element <a href="rendering.html#represents">represents</a> a footer
1063: for its nearest ancestor <a href="content-models.html#sectioning-content">sectioning content</a> or
1064: <a href="#sectioning-root">sectioning root</a> element. A footer typically contains
1065: information about its section such as who wrote it, links to related
1066: documents, copyright data, and the like.</p><p class="note">Contact information for the author or editor of a
1067: section belongs in an <code><a href="#the-address-element">address</a></code> element, possibly itself
1068: inside a <code><a href="#the-footer-element">footer</a></code>.</p><p>Footers don't necessarily have to appear at the <em>end</em> of a
1069: section, though they usually do.</p><p>When the <code><a href="#the-footer-element">footer</a></code> element contains entire sections,
1070: they <a href="rendering.html#represents" title="represents">represent</a> appendices, indexes,
1071: long colophons, verbose license agreements, and other such
1072: content.</p><p class="note">The <code><a href="#the-footer-element">footer</a></code> element is not
1073: <a href="content-models.html#sectioning-content">sectioning content</a>; it doesn't introduce a new
1074: section.</p><p>When the nearest ancestor <a href="content-models.html#sectioning-content">sectioning content</a> or
1075: <a href="#sectioning-root">sectioning root</a> element is <a href="dom.html#the-body-element">the body
1076: element</a>, then it applies to the whole page.</p><div class="example">
1077:
1078: <p>Here is a page with two footers, one at the top and one at the
1079: bottom, with the same content:</p>
1080:
1081: <pre><body>
1082: <footer><a href="../">Back to index...</a></footer>
1083: <hgroup>
1084: <h1>Lorem ipsum</h1>
1085: <h2>The ipsum of all lorems</h2>
1086: </hgroup>
1087: <p>A dolor sit amet, consectetur adipisicing elit, sed do eiusmod
1088: tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
1089: veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
1090: ea commodo consequat. Duis aute irure dolor in reprehenderit in
1091: voluptate velit esse cillum dolore eu fugiat nulla
1092: pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
1093: culpa qui officia deserunt mollit anim id est laborum.</p>
1094: <footer><a href="../">Back to index...</a></footer>
1095: </body></pre>
1096:
1097: </div><div class="example">
1098:
1099: <p>Here is an example which shows the <code><a href="#the-footer-element">footer</a></code> element
1100: being used both for a site-wide footer and for a section
1101: footer.</p>
1102:
1103: <pre><!DOCTYPE HTML>
1104: <HTML><HEAD>
1105: <TITLE>The Ramblings of a Scientist</TITLE>
1106: <BODY>
1107: <H1>The Ramblings of a Scientist</H1>
1108: <ARTICLE>
1109: <H1>Episode 15</H1>
1110: <VIDEO SRC="/fm/015.ogv" CONTROLS PRELOAD>
1111: <P><A HREF="/fm/015.ogv">Download video</A>.</P>
1112: </VIDEO>
1113: <FOOTER> <!-- footer for article -->
1114: <P>Published <TIME PUBDATE DATETIME="2009-10-21T18:26-07:00"></TIME></P>
1115: </FOOTER>
1116: </ARTICLE>
1117: <ARTICLE>
1118: <H1>My Favorite Trains</H1>
1119: <P>I love my trains. My favorite train of all time is a Köf.</P>
1120: <P>It is fun to see them pull some coal cars because they look so
1121: dwarfed in comparison.</P>
1122: <FOOTER> <!-- footer for article -->
1123: <P>Published <TIME PUBDATE DATETIME="2009-09-15T14:54-07:00"></TIME></P>
1124: </FOOTER>
1125: </ARTICLE>
1126: <FOOTER> <!-- site wide footer -->
1127: <NAV>
1128: <P><A HREF="/credits.html">Credits</A> —
1129: <A HREF="/tos.html">Terms of Service</A> —
1130: <A HREF="/index.html">Blog Index</A></P>
1131: </NAV>
1132: <P>Copyright © 2009 Gordon Freeman</P>
1133: </FOOTER>
1134: </BODY>
1135: </HTML></pre>
1136:
1137: </div><h4 id="the-address-element"><span class="secno">4.4.10 </span>The <dfn><code>address</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1138: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
1139: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
1140: <dt>Contexts in which this element may be used:</dt>
1141: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
1142: <dt>Content model:</dt>
1143: <dd><a href="content-models.html#flow-content">Flow content</a>, but with no <a href="content-models.html#heading-content">heading
1144: content</a> descendants, no <a href="content-models.html#sectioning-content">sectioning content</a>
1145: descendants, and no <code><a href="#the-header-element">header</a></code>, <code><a href="#the-footer-element">footer</a></code>, or
1146: <code><a href="#the-address-element">address</a></code> element descendants.</dd>
1147: <dt>Content attributes:</dt>
1148: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
1149: <dt>DOM interface:</dt>
1150: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
1151: </dl><p>The <code><a href="#the-address-element">address</a></code> element <a href="rendering.html#represents">represents</a> the
1152: contact information for its nearest <code><a href="#the-article-element">article</a></code> or
1153: <code><a href="#the-body-element-0">body</a></code> element ancestor. If that is <a href="dom.html#the-body-element">the body
1154: element</a>, then the contact information applies to the document
1155: as a whole.</p><div class="example">
1156: <p>For example, a page at the W3C Web site related to HTML might
1157: include the following contact information:</p>
1158: <pre><ADDRESS>
1159: <A href="../People/Raggett/">Dave Raggett</A>,
1160: <A href="../People/Arnaud/">Arnaud Le Hors</A>,
1161: contact persons for the <A href="Activity">W3C HTML Activity</A>
1162: </ADDRESS></pre>
1163: </div><p>The <code><a href="#the-address-element">address</a></code> element must not be used to represent
1164: arbitrary addresses (e.g. postal addresses), unless those addresses
1165: are in fact the relevant contact information. (The <code><a href="grouping-content.html#the-p-element">p</a></code>
1166: element is the appropriate element for marking up postal addresses
1167: in general.)</p><p>The <code><a href="#the-address-element">address</a></code> element must not contain information
1168: other than contact information.</p><div class="example">
1169: <p>For example, the following is non-conforming use of the
1170: <code><a href="#the-address-element">address</a></code> element:</p>
1171: <pre class="bad"><ADDRESS>Last Modified: 1999/12/24 23:37:50</ADDRESS></pre>
1172: </div><p>Typically, the <code><a href="#the-address-element">address</a></code> element would be included
1173: along with other information in a <code><a href="#the-footer-element">footer</a></code> element.</p><div class="impl">
1174:
1175: <p>The contact information for a node <var title="">node</var> is a
1176: collection of <code><a href="#the-address-element">address</a></code> elements defined by the first
1177: applicable entry from the following list:</p>
1178:
1179: <dl class="switch"><dt>If <var title="">node</var> is an <code><a href="#the-article-element">article</a></code> element</dt>
1180: <dt>If <var title="">node</var> is a <code><a href="#the-body-element-0">body</a></code> element</dt>
1181:
1182: <dd>
1183:
1184: <p>The contact information consists of all the
1185: <code><a href="#the-address-element">address</a></code> elements that have <var title="">node</var>
1186: as an ancestor and do not have another <code><a href="#the-body-element-0">body</a></code> or
1187: <code><a href="#the-article-element">article</a></code> element ancestor that is a descendant of <var title="">node</var>.</p>
1188:
1189: </dd>
1190:
1191: <dt>If <var title="">node</var> has an ancestor element that is an <code><a href="#the-article-element">article</a></code> element</dt>
1192: <dt>If <var title="">node</var> has an ancestor element that is a <code><a href="#the-body-element-0">body</a></code> element</dt>
1193:
1194: <dd>
1195:
1196: <p>The contact information of <var title="">node</var> is the same
1197: as the contact information of the nearest <code><a href="#the-article-element">article</a></code> or
1198: <code><a href="#the-body-element-0">body</a></code> element ancestor, whichever is nearest.</p>
1199:
1200: </dd>
1201:
1202: <dt>If <var title="">node</var>'s <code><a href="infrastructure.html#document">Document</a></code> has <a href="dom.html#the-body-element" title="the body element">a body element</a></dt>
1203:
1204: <dd>
1205:
1206: <p>The contact information of <var title="">node</var> is the same
1207: as the contact information <a href="dom.html#the-body-element">the body element</a> of the
1208: <code><a href="infrastructure.html#document">Document</a></code>.</p>
1209:
1210: </dd>
1211:
1212: <dt>Otherwise</dt>
1213:
1214: <dd>
1215:
1216: <p>There is no contact information for <var title="">node</var>.</p>
1217:
1218: </dd>
1219:
1220: </dl><p>User agents may expose the contact information of a node to the
1221: user, or use it for other purposes, such as indexing sections based
1222: on the sections' contact information.</p>
1223:
1224: </div><h4 id="headings-and-sections"><span class="secno">4.4.11 </span><dfn>Headings and sections</dfn></h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <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">h6</a></code> elements and the
1225: <code><a href="#the-hgroup-element">hgroup</a></code> element are headings.</p><p>The first element of <a href="content-models.html#heading-content">heading content</a> in an element
1226: of <a href="content-models.html#sectioning-content">sectioning content</a> <a href="rendering.html#represents">represents</a> the
1227: heading for that section. Subsequent headings of equal or higher
1228: <a href="#rank">rank</a> start new (implied) sections, headings of lower
1229: <a href="#rank">rank</a> start implied subsections that are part of the
1230: previous one. In both cases, the element <a href="rendering.html#represents">represents</a> the
1231: heading of the implied section.</p><p>Certain elements are said to be <dfn id="sectioning-root" title="sectioning
1232: root">sectioning roots</dfn>, including <code><a href="grouping-content.html#the-blockquote-element">blockquote</a></code> and
1233: <code><a href="tabular-data.html#the-td-element">td</a></code> elements. These elements can have their own
1234: outlines, but the sections and headings inside these elements do not
1235: 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="grouping-content.html#the-blockquote-element">blockquote</a></code></li>
1236: <li><code><a href="#the-body-element-0">body</a></code></li>
1237: <!-- v2DATAGRID <li><code>datagrid</code></li> -->
1238: <li><code><a href="interactive-elements.html#the-details-element">details</a></code></li>
1239: <li><code><a href="forms.html#the-fieldset-element">fieldset</a></code></li>
1240: <li><code><a href="grouping-content.html#the-figure-element">figure</a></code></li>
1241: <li><code><a href="tabular-data.html#the-td-element">td</a></code></li>
1242: </ul><!-- a root element isn't a sectioning root. This means, for
1243: instance, that you don't get an outline if you just have a random
1244: XML file with <html:h1> elements in it. Other vocabs need to define
1245: what their sectioning root is. --><p><a href="content-models.html#sectioning-content">Sectioning content</a> elements are always considered
1246: subsections of their nearest ancestor <a href="#sectioning-root">sectioning root</a>
1247: or their nearest ancestor element of <a href="content-models.html#sectioning-content">sectioning
1248: content</a>, whichever is nearest, regardless of what implied
1249: sections other headings may have created.</p><div class="example">
1250: <p>For the following fragment:</p>
1251: <pre><body>
1252: <h1>Foo</h1>
1253: <h2>Bar</h2>
1254: <blockquote>
1255: <h3>Bla</h3>
1256: </blockquote>
1257: <p>Baz</p>
1258: <h2>Quux</h2>
1259: <section>
1260: <h3>Thud</h3>
1261: </section>
1262: <p>Grunt</p>
1263: </body></pre>
1264: <p>...the structure would be:</p>
1265: <ol><li>
1266: Foo (heading of explicit <code><a href="#the-body-element-0">body</a></code> section, containing the "Grunt" paragraph)
1267: <ol><li>
1268: Bar (heading starting implied section, containing a block quote and the "Baz" paragraph)
1269: </li>
1270: <li>
1271: Quux (heading starting implied section with no content other than the heading itself)
1272: </li>
1273: <li>
1274: Thud (heading of explicit <code><a href="#the-section-element">section</a></code> section)
1275: </li>
1276: </ol></li>
1277: </ol><p>Notice how the <code><a href="#the-section-element">section</a></code> ends the earlier implicit
1278: section so that a later paragraph ("Grunt") is back at the top
1279: level.</p>
1280: </div><p>Sections may contain headings of any <a href="#rank">rank</a>, but
1281: authors are strongly encouraged to either use only <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>
1282: elements, or to use elements of the appropriate <a href="#rank">rank</a>
1283: for the section's nesting level.</p><p>Authors are also encouraged to explicitly wrap sections in
1284: elements of <a href="content-models.html#sectioning-content">sectioning content</a>, instead of relying on
1285: the implicit sections generated by having multiple headings in one
1286: element of <a href="content-models.html#sectioning-content">sectioning content</a>.</p><div class="example">
1287: <p>For example, the following is correct:</p>
1288:
1289: <pre><body>
1290: <h4>Apples</h4>
1291: <p>Apples are fruit.</p>
1292: <section>
1293: <h2>Taste</h2>
1294: <p>They taste lovely.</p>
1295: <h6>Sweet</h6>
1296: <p>Red apples are sweeter than green ones.</p>
1297: <h1>Color</h1>
1298: <p>Apples come in various colors.</p>
1299: </section>
1300: </body></pre>
1301:
1302: <p>However, the same document would be more clearly expressed
1303: as:</p>
1304:
1305: <pre><body>
1306: <h1>Apples</h1>
1307: <p>Apples are fruit.</p>
1308: <section>
1309: <h2>Taste</h2>
1310: <p>They taste lovely.</p>
1311: <section>
1312: <h3>Sweet</h3>
1313: <p>Red apples are sweeter than green ones.</p>
1314: </section>
1315: </section>
1316: <section>
1317: <h2>Color</h2>
1318: <p>Apples come in various colors.</p>
1319: </section>
1320: </body></pre>
1321:
1322: <p>Both of the documents above are semantically identical and would
1323: produce the same outline in compliant user agents.</p>
1324:
1325: </div><h5 id="outlines"><span class="secno">4.4.11.1 </span>Creating an outline</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><div class="impl">
1326:
1327: <!-- v2 idea: It would be nice if there was a way to use this to
1328: autogenerate a table of contents or some such -->
1329:
1330: <p>This section defines an algorithm for creating an outline for a
1331: <a href="content-models.html#sectioning-content">sectioning content</a> element or a <a href="#sectioning-root">sectioning
1332: root</a> element. It is defined in terms of a walk over the nodes
1333: of a DOM tree, in tree order, with each node being visited when it
1334: is <i>entered</i> and when it is <i>exited</i> during the walk.</p>
1335:
1336: </div><p>The <dfn id="outline">outline</dfn> for a <a href="content-models.html#sectioning-content">sectioning content</a>
1337: element or a <a href="#sectioning-root">sectioning root</a> element consists of a list
1338: 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
1339: corresponds to some nodes in the original DOM tree. Each section can
1340: have one heading associated with it, and can contain any number of
1341: further nested sections. <span class="impl">The algorithm for the
1342: outline also associates each node in the DOM tree with a particular
1343: section and potentially a heading.</span> (The sections in the
1344: outline aren't <code><a href="#the-section-element">section</a></code> elements, though some may
1345: correspond to such elements — they are merely conceptual
1346: sections.)</p><div class="example">
1347:
1348: <p>The following markup fragment:</p>
1349:
1350: <pre><body>
1351: <h1>A</h1>
1352: <p>B</p>
1353: <h2>C</h2>
1354: <p>D</p>
1355: <h2>E</h2>
1356: <p>F</p>
1357: </body></pre>
1358:
1359: <p>...results in the following outline being created for the
1360: <code><a href="#the-body-element-0">body</a></code> node (and thus the entire document):</p>
1361:
1362: <ol class="brief"><li>
1363: <p>Section created for <code><a href="#the-body-element-0">body</a></code> node.</p>
1364: <p>Associated with heading "A".</p>
1365: <p>Also associated with paragraph "B".</p>
1366: <p>Nested sections:</p>
1367: <ol class="brief"><li>
1368: <p>Section implied for first <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code> element.</p>
1369: <p>Associated with heading "C".</p>
1370: <p>Also associated with paragraph "D".</p>
1371: <p>No nested sections.</p>
1372: </li>
1373: <li>
1374: <p>Section implied for second <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code> element.</p>
1375: <p>Associated with heading "E".</p>
1376: <p>Also associated with paragraph "F".</p>
1377: <p>No nested sections.</p>
1378: </li>
1379: </ol></li>
1380: </ol></div><div class="impl">
1381:
1382: <p>The algorithm that must be followed during a walk of a DOM
1383: subtree rooted at a <a href="content-models.html#sectioning-content">sectioning content</a> element or a
1384: <a href="#sectioning-root">sectioning root</a> element to determine that element's
1385: <a href="#outline">outline</a> is as follows:</p>
1386:
1387: <ol><li><p>Let <var title="">current outlinee</var> be null. (It holds
1388: the element whose <a href="#outline">outline</a> is being created.)</p></li>
1389:
1390: <li><p>Let <var title="">current section</var> be null. (It holds a
1391: pointer to a <a href="#concept-section" title="concept-section">section</a>, so that
1392: elements in the DOM can all be associated with a section.)</p></li>
1393:
1394: <li><p>Create a stack to hold elements, which is used to handle
1395: nesting. Initialize this stack to empty.</p></li>
1396:
1397: <li>
1398:
1399: <p>As you walk over the DOM in <a href="infrastructure.html#tree-order">tree order</a>, trigger
1400: the first relevant step below for each element as you enter and
1401: exit it.</p>
1402:
1403: <dl class="switch"><dt>If the top of the stack is an element, and you are exiting
1404: that element</dt>
1405:
1406: <dd>
1407:
1408: <p class="note">The element being exited is a <a href="content-models.html#heading-content">heading
1409: content</a> element.</p>
1410:
1411: <p>Pop that element from the stack.</p>
1412:
1413: </dd>
1414:
1415:
1416: <dt>If the top of the stack is a <a href="content-models.html#heading-content">heading content</a>
1417: element</dt>
1418:
1419: <dd><p>Do nothing.</p></dd>
1420:
1421:
1422: <dt>When entering a <a href="content-models.html#sectioning-content">sectioning content</a> element or a
1423: <a href="#sectioning-root">sectioning root</a> element</dt>
1424:
1425: <dd>
1426:
1427: <p>If <var title="">current outlinee</var> is not null, and the
1428: <var title="">current section</var> has no heading, create an
1429: implied heading and let that be the heading for the <var title="">current section</var>.</p>
1430:
1431: <p>If <var title="">current outlinee</var> is not null, push
1432: <var title="">current outlinee</var> onto the stack.</p>
1433:
1434: <p>Let <var title="">current outlinee</var> be the element
1435: that is being entered.</p>
1436:
1437: <p>Let <var title="">current section</var> be a newly created
1438: <a href="#concept-section" title="concept-section">section</a> for the <var title="">current outlinee</var> element.</p>
1439:
1440: <p>Let there be a new <a href="#outline">outline</a> for the new <var title="">current outlinee</var>, initialized with just the new
1441: <var title="">current section</var> as the only <a href="#concept-section" title="concept-section">section</a> in the outline.</p>
1442:
1443: </dd>
1444:
1445:
1446: <dt>When exiting a <a href="content-models.html#sectioning-content">sectioning content</a> element, if
1447: the stack is not empty</dt>
1448:
1449: <dd>
1450:
1451: <p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</p>
1452:
1453: <p>Let <var title="">current section</var> be the last section
1454: in the <a href="#outline">outline</a> of the <var title="">current
1455: outlinee</var> element.</p>
1456:
1457: <p>Append the <a href="#outline">outline</a> of the <a href="content-models.html#sectioning-content">sectioning
1458: content</a> element being exited to the <var title="">current
1459: section</var>. (This does not change which section is the last
1460: section in the <a href="#outline">outline</a>.)</p>
1461:
1462: </dd>
1463:
1464:
1465: <dt>When exiting a <a href="#sectioning-root">sectioning root</a> element, if the
1466: stack is not empty</dt>
1467:
1468: <dd>
1469:
1470: <p>Run these steps:</p>
1471:
1472: <ol><li><p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</p></li>
1473:
1474: <li><p>Let <var title="">current section</var> be the last
1475: section in the <a href="#outline">outline</a> of the <var title="">current
1476: outlinee</var> element.</p></li>
1477:
1478: <li><p><i>Finding the deepest child</i>: If <var title="">current section</var> has no child sections, stop
1479: these steps.</p></li>
1480:
1481: <li><p>Let <var title="">current section</var> be the last
1482: child <a href="#concept-section" title="concept-section">section</a> of the
1483: current <var title="">current section</var>.</p></li>
1484:
1485: <li><p>Go back to the substep labeled <i>finding the deepest
1486: child</i>.</p></li>
1487:
1488: </ol></dd>
1489:
1490:
1491: <dt>When exiting a <a href="content-models.html#sectioning-content">sectioning content</a> element or a
1492: <a href="#sectioning-root">sectioning root</a> element</dt>
1493:
1494: <dd>
1495:
1496: <p class="note">The <var title="">current outlinee</var> is
1497: the element being exited.</p>
1498:
1499: <p>Let <var title="">current section</var> be the first <a href="#concept-section" title="concept-section">section</a> in the
1500: <a href="#outline">outline</a> of the <var title="">current outlinee</var>
1501: element.</p>
1502:
1503: <p>Skip to the next step in the overall set of steps. (The walk
1504: is over.)</p>
1505:
1506: </dd>
1507:
1508:
1509: <dt>If the <var title="">current outlinee</var> is null</dt>
1510:
1511: <dd><p>Do nothing.</p></dd>
1512:
1513:
1514: <dt>When entering a <a href="content-models.html#heading-content">heading content</a> element</dt>
1515:
1516: <dd>
1517:
1518: <p>If the <var title="">current section</var> has no heading,
1519: let the element being entered be the heading for the <var title="">current section</var>.</p>
1520:
1521: <p>Otherwise, if the element being entered has a
1522: <a href="#rank">rank</a> equal to or greater than the heading of the
1523: last section of the <a href="#outline">outline</a> of the <var title="">current outlinee</var>, then create a new <a href="#concept-section" title="concept-section">section</a> and append it to the
1524: <a href="#outline">outline</a> of the <var title="">current outlinee</var>
1525: element, so that this new section is the new last section of
1526: that outline. Let <var title="">current section</var> be that
1527: new section. Let the element being entered be the new heading
1528: for the <var title="">current section</var>.</p>
1529:
1530: <p>Otherwise, run these substeps:</p>
1531:
1532: <ol><li><p>Let <var title="">candidate section</var> be <var title="">current section</var>.</p></li>
1533:
1534: <li><p>If the element being entered has a <a href="#rank">rank</a>
1535: lower than the <a href="#rank">rank</a> of the heading of the <var title="">candidate section</var>, 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
1536: section is the last section in the outline.) Let <var title="">current section</var> be this new section. Let the
1537: element being entered be the new heading for the <var title="">current section</var>. Abort these substeps.</p>
1538:
1539: </li><li><p>Let <var title="">new candidate section</var> be the
1540: <a href="#concept-section" title="concept-section">section</a> that contains <var title="">candidate section</var> in the <a href="#outline">outline</a> of
1541: <var title="">current outlinee</var>.</p></li>
1542:
1543: <li><p>Let <var title="">candidate section</var> be <var title="">new candidate section</var>.</p></li>
1544:
1545: <li><p>Return to step 2.</p></li>
1546:
1547: </ol><p>Push the element being entered onto the stack. (This causes
1548: the algorithm to skip any descendants of the element.)</p>
1549:
1550: <p class="note">Recall that <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code> has the
1551: <em>highest</em> rank, and <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> has the lowest
1552: rank.</p>
1553:
1554: </dd>
1555:
1556:
1557: <dt>Otherwise</dt>
1558:
1559: <dd><p>Do nothing.</p></dd>
1560:
1561: </dl><p id="associatedSection">In addition, whenever you exit a node,
1562: after doing the steps above, if <var title="">current
1563: section</var> is not null, associate the node with the <a href="#concept-section" title="concept-section">section</a> <var title="">current
1564: section</var>.</p>
1565:
1566: </li>
1567:
1568: <li><p>If the <var title="">current outlinee</var> is null,
1569: then there was no <a href="content-models.html#sectioning-content">sectioning content</a> element or
1570: <a href="#sectioning-root">sectioning root</a> element in the DOM. There is no
1571: <a href="#outline">outline</a>. Abort these steps.</p></li>
1572:
1573: <li><p>Associate any nodes that were not associated with a <a href="#concept-section" title="concept-section">section</a> in the steps above with <var title="">current outlinee</var> as their section.</p></li>
1574:
1575: <li><p>Associate all nodes with the heading of the <a href="#concept-section" title="concept-section">section</a> with which they are
1576: associated, if any.</p></li>
1577:
1578: <li><p>If <var title="">current outlinee</var> is <a href="dom.html#the-body-element">the body
1579: element</a>, then the outline created for that element is the
1580: <a href="#outline">outline</a> of the entire document.</p></li>
1581:
1582: </ol><p>The tree of sections created by the algorithm above, or a proper
1583: subset thereof, must be used when generating document outlines, for
1584: example when generating tables of contents.</p>
1585:
1586: <p>When creating an interactive table of contents, entries should
1587: jump the user to the relevant <a href="content-models.html#sectioning-content">sectioning content</a>
1588: element, if the <a href="#concept-section" title="concept-section">section</a> was
1589: created for a real element in the original document, or to the
1590: relevant <a href="content-models.html#heading-content">heading content</a> element, if the <a href="#concept-section" title="concept-section">section</a> in the tree was generated for
1591: a heading in the above process.</p>
1592:
1593: <p class="note">Selecting the first <a href="#concept-section" title="concept-section">section</a> of the document therefore
1594: always takes the user to the top of the document, regardless of
1595: where the first heading in the <code><a href="#the-body-element-0">body</a></code> is to be found.</p>
1596:
1597: <p>The <dfn id="outline-depth">outline depth</dfn> of a <a href="content-models.html#heading-content">heading content</a>
1598: element associated with a <a href="#concept-section" title="concept-section">section</a> <var title="">section</var>
1599: is the number of <a href="#concept-section" title="concept-section">sections</a> that
1600: are ancestors of <var title="">section</var> in the
1601: <a href="#outline">outline</a> that <var title="">section</var> finds itself
1602: in when the <a href="#outline" title="outline">outlines</a> of its
1603: <code><a href="infrastructure.html#document">Document</a></code>'s elements are created, plus 1. The
1604: <a href="#outline-depth">outline depth</a> of a <a href="content-models.html#heading-content">heading content</a> element
1605: not associated with a <a href="#concept-section" title="concept-section">section</a>
1606: is 1.</p>
1607:
1608: <p>User agents should provide default headings for sections that do
1609: not have explicit section headings.</p>
1610:
1611: <div class="example">
1612:
1613: <p>Consider the following snippet:</p>
1614:
1615: <pre><body>
1616: <nav>
1617: <p><a href="/">Home</a></p>
1618: </nav>
1619: <p>Hello world.</p>
1620: <aside>
1621: <p>My cat is cute.</p>
1622: </aside>
1623: </body></pre>
1624:
1625: <p>Although it contains no headings, this snippet has three
1626: sections: a document (the <code><a href="#the-body-element-0">body</a></code>) with two subsections
1627: (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
1628: present the outline as follows:</p>
1629:
1630: <ol class="brief"><li>Untitled document
1631: <ol><li>Navigation</li>
1632: <li>Sidebar</li>
1633: </ol></li>
1634: </ol><p>These default headings ("Untitled document", "Navigation",
1635: "Sidebar") are not specified by this specification, and might vary
1636: with the user's language, the page's language, the user's
1637: preferences, the user agent implementor's preferences, etc.</p>
1638:
1639: </div>
1640:
1641: <div class="note">
1642:
1643: <p>The following JavaScript function shows how the tree walk could
1644: be implemented. The <var title="">root</var> argument is the root
1645: of the tree to walk, and the <var title="">enter</var> and <var title="">exit</var> arguments are callbacks that are called with
1646: the nodes as they are entered and exited. <a href="references.html#refsECMA262">[ECMA262]</a></p>
1647:
1648: <pre>function (root, enter, exit) {
1649: var node = root;
1650: start: while (node) {
1651: enter(node);
1652: if (node.firstChild) {
1653: node = node.firstChild;
1654: continue start;
1655: }
1656: while (node) {
1657: exit(node);
1658: if (node.nextSibling) {
1659: node = node.nextSibling;
1660: continue start;
1661: }
1662: if (node == root)
1663: node = null;
1664: else
1665: node = node.parentNode;
1666: }
1667: }
1668: }</pre>
1669:
1670: </div>
1671:
1672: </div></body></html>
Webmaster