@@ -17475,97 +17475,251 @@ interface <dfn interface>HTMLHeadingElement</dfn> : <span>HTMLElement</span> {
17475
17475
17476
17476
17477
17477
17478
- <h4><dfn>Headings and sections</dfn></h4>
17478
+ <h4><dfn>Headings and sections</dfn></h4>
17479
17479
17480
- <p>The <code>h1</code>–<code>h6</code> elements are headings.</p>
17480
+ <p><span>Heading content</span> elements have a <dfn>heading level</dfn>, which is
17481
+ an unsigned integer. It is determined as follows for a given <span>heading content</span> element
17482
+ <var>heading</var>:</p>
17481
17483
17482
- <p>The first element of <span>heading content</span> in an element of <span>sectioning
17483
- content</span> <span>represents</span> the heading for that section. Subsequent headings of equal
17484
- or higher <span>rank</span> start new (implied) sections, headings of lower <span>rank</span>
17485
- start implied subsections that are part of the previous one. In both cases, the element
17486
- <span>represents</span> the heading of the implied section.</p>
17484
+ <ol>
17485
+
17486
+ <li>
17487
+ <p>Switch on <var>heading</var>:</p>
17487
17488
17488
- <p>Certain elements are said to be <dfn data-x="sectioning root">sectioning roots</dfn>, including
17489
- <code>blockquote</code> and <code>td</code> elements. These elements can have their own outlines,
17490
- but the sections and headings inside these elements do not contribute to the outlines of their
17491
- ancestors.</p>
17489
+ <dl class="switch">
17490
+ <dt><code>h2</code></dt>
17491
+ <dd>Return 2.</dd>
17492
17492
17493
- <!-- when updating this also update the category index -->
17494
- <ul class="brief category-list">
17495
- <li><code>blockquote</code></li>
17496
- <li><code>body</code></li>
17497
- <li><code>details</code></li>
17498
- <li><code>dialog</code></li>
17499
- <li><code>fieldset</code></li>
17500
- <li><code>figure</code></li>
17501
- <li><code>td</code></li>
17502
- </ul>
17493
+ <dt><code>h3</code></dt>
17494
+ <dd>Return 3.</dd>
17495
+
17496
+ <dt><code>h4</code></dt>
17497
+ <dd>Return 4.</dd>
17498
+
17499
+ <dt><code>h5</code></dt>
17500
+ <dd>Return 5.</dd>
17501
+
17502
+ <dt><code>h6</code></dt>
17503
+ <dd>Return 6.</dd>
17504
+ </dl>
17505
+ </li>
17506
+
17507
+ </ol>
17508
+
17509
+ <p>A <span>heading content</span> element <span>represents</span> a <dfn data-x="concept-heading">heading</dfn>.
17510
+ The lower a <span data-x="concept-heading">heading</span>'s <span>heading level</span> is, the more important
17511
+ the <span data-x="concept-heading">heading</span> is.</p>
17512
+
17513
+ <p>The <dfn>document headings</dfn> are all <span data-x="concept-heading">headings</span> in a
17514
+ document, in <span>tree order</span>.</p>
17515
+
17516
+ <div w-nodev>
17503
17517
17504
- <!-- a document element isn't a sectioning root. This means, for instance, that you don't get an
17505
- outline if you just have a random XML file with <html:h1> elements in it. Other vocabs need to
17506
- define what their sectioning root is. -->
17518
+ <p>The <span>document headings</span> must be used for generating document outlines, for
17519
+ example when generating tables of contents. When creating an interactive table of contents,
17520
+ entries should jump the user to the relevant <span data-x="concept-heading">heading</span>.</p>
17521
+
17522
+ </div>
17523
+
17524
+ <p>If a document has a <span data-x="concept-heading">heading</span>, at least a single <span
17525
+ data-x="concept-heading">heading</span> within <span>document headings</span> must have a
17526
+ <span>heading level</span> of 1.</p>
17527
+
17528
+ <p>Each <span data-x="concept-heading">heading</span> following another <span
17529
+ data-x="concept-heading">heading</span> <var>lead</var> in <span>document headings</span> must
17530
+ have a <span>heading level</span> that is less, equal, or 1 greater than <var>lead</var>'s
17531
+ <span>heading level</span>.</p>
17532
+
17533
+ <p class="note">Authors are encouraged to avoid having a <span>sectioning content</span> element
17534
+ <var>section</var> without a <span data-x="concept-heading">heading</span> descendant whose
17535
+ nearest ancestor <span>sectioning content</span> element is not <var>section</var>. I.e., avoid
17536
+ having a section without a heading.</p>
17507
17537
17508
17538
<div class="example">
17539
+ <p>The following example is non-conforming:</p>
17509
17540
17510
- <p>A document can contain multiple top-level headings:</p>
17541
+ <pre><code class="html" data-x=""><body>
17542
+ <h4>Apples</h4>
17543
+ <p>Apples are fruit.</p>
17544
+ <section>
17545
+ <h2>Taste</h2>
17546
+ <p>They taste lovely.</p>
17547
+ </section>
17548
+ </body></code></pre>
17511
17549
17512
- <pre><code class="html"><!DOCTYPE HTML>
17513
- <html lang=en>
17514
- <title>Alphabetic Fruit</title>
17515
- <h1>Apples</h1>
17516
- <p>Pomaceous.</p>
17517
- <h1>Bananas</h1>
17518
- <p>Edible.</p>
17519
- <h1>Carambola</h1>
17520
- <p>Star.</p></code></pre>
17550
+ <p>It could be written as follows and then it would be conforming:</p>
17521
17551
17522
- <p>This would form the following simple outline consisting of three top-level sections:</p>
17552
+ <pre><code class="html" data-x=""><body>
17553
+ <h1>Apples</h1>
17554
+ <p>Apples are fruit.</p>
17555
+ <section>
17556
+ <h2>Taste</h2>
17557
+ <p>They taste lovely.</p>
17558
+ </section>
17559
+ </body></code></pre>
17560
+
17561
+ </div>
17562
+
17563
+ <div class="example">
17564
+ <p>The following markup fragment:</p>
17565
+
17566
+ <pre><code class="html" data-x=""><body>
17567
+ <hgroup id="document-title">
17568
+ <h1>HTML</h1>
17569
+ <p>Living Standard — Last Updated 12 August 2016</p>
17570
+ </hgroup>
17571
+ <p>Some intro to the document.</p>
17572
+ <h2>Table of contents</h2>
17573
+ <ol id=toc>...</ol>
17574
+ <h2>First section</h2>
17575
+ <p>Some intro to the first section.</p>
17576
+ </body></code></pre>
17577
+
17578
+ <p>...results in 3 <span>document headings</span>:</p>
17523
17579
17524
17580
<ol class="brief">
17525
- <li> Apples
17526
- <li> Bananas
17527
- <li> Carambola
17581
+ <li><p><code data-x=""><hgroup id="document-title">...</hgroup></code> consisting of <code
17582
+ data-x=""><h1>HTML</h1></code> and <code
17583
+ data-x=""><p>Living Standard — Last Updated 12 August 2016</p></code>.</p></li>
17584
+
17585
+ <li><p><code data-x=""><h2>Table of contents</h2></code>.</p></li>
17586
+
17587
+ <li><p><code data-x=""><h2>First section</h2></code>.</p></li>
17528
17588
</ol>
17529
17589
17530
- <p>Effectively, the <code>body</code> element is split into three. </p>
17590
+ <p>A rendered view of the <span>document headings</span> might look like: </p>
17531
17591
17592
+ <p><img src="/images/outline.svg" width="465" height="120" alt="Top-level section with the
17593
+ heading and associated text "HTML: Living Standard — Last Updated 12 August 2016" and two
17594
+ subsections; "Table of contents" and "First section"."></p>
17532
17595
</div>
17533
17596
17597
+ <div class="example">
17598
+ <p>First, here is a document, which is a book with very short chapters and subsections:</p>
17534
17599
17535
- <h5>Exposing outlines to users</h5>
17600
+ <pre><code class="html" data-x=""><!DOCTYPE HTML>
17601
+ <html lang=en>
17602
+ <title>The Tax Book (all in one page)</title>
17603
+ <h1>The Tax Book</h1>
17604
+ <h2>Earning money</h2>
17605
+ <p>Earning money is good.</p>
17606
+ <h3>Getting a job</h3>
17607
+ <p>To earn money you typically need a job.</p>
17608
+ <h2>Spending money</h2>
17609
+ <p>Spending is what money is mainly used for.</p>
17610
+ <h3>Cheap things</h3>
17611
+ <p>Buying cheap things often not cost-effective.</p>
17612
+ <h3>Expensive things</h3>
17613
+ <p>The most expensive thing is often not the most cost-effective either.</p>
17614
+ <h2>Investing money</h2>
17615
+ <p>You can lend your money to other people.</p>
17616
+ <h2>Losing money</h2>
17617
+ <p>If you spend money or invest money, sooner or later you will lose money.
17618
+ <h3>Poor judgement</h3>
17619
+ <p>Usually if you lose money it's because you made a mistake.</p></code></pre>
17620
+
17621
+ <p>Its <span>document headings</span> could be presented as follows:</p>
17536
17622
17537
- <p>User agents are encouraged to expose page outlines to users to aid in navigation. This is
17538
- especially true for non-visual media, e.g. screen readers.</p>
17623
+ <ol class="brief">
17624
+ <li> The Tax Book
17625
+ <ol class="brief">
17626
+ <li> Earning money
17627
+ <ol class="brief">
17628
+ <li> Getting a job
17629
+ </ol>
17630
+ <li> Spending money
17631
+ <ol class="brief">
17632
+ <li> Cheap things
17633
+ <li> Expensive things
17634
+ </ol>
17635
+ <li> Investing money
17636
+ <li> Losing money
17637
+ <ol class="brief">
17638
+ <li> Poor judgement
17639
+ </ol>
17640
+ </ol>
17641
+ </ol>
17539
17642
17540
- <p>However, to mitigate the difficulties that arise from authors misusing <span>sectioning
17541
- content </span>, user agents are also encouraged to offer a mode that navigates the page using
17542
- <span>heading content</span> alone.</p >
17643
+ <p>Notice that the <code>title</code> element is not a <span
17644
+ data-x="concept-heading">heading </span>.</p>
17645
+ </div >
17543
17646
17544
17647
<div class="example">
17648
+ <p>A document can contain multiple top-level headings:</p>
17545
17649
17546
- <p>For instance, a user agent could map the arrow keys as follows:</p>
17650
+ <pre><code class="html" data-x=""><!DOCTYPE HTML>
17651
+ <html lang=en>
17652
+ <title>Alphabetic Fruit</title>
17653
+ <h1>Apples</h1>
17654
+ <p>Pomaceous.</p>
17655
+ <h1>Bananas</h1>
17656
+ <p>Edible.</p>
17657
+ <h1>Carambola</h1>
17658
+ <p>Star.</p></code></pre>
17659
+ </div>
17547
17660
17548
- <dl >
17549
- <dt><kbd><kbd>Shift</kbd> + <kbd>← Left</kbd></kbd>
17550
- <dd>Go to previous section, including subsections of previous sections
17661
+ <div class="example" >
17662
+ <p>The following example is non-conforming as it has no <span
17663
+ data-x="concept-heading">heading</span> whose <span>heading level</span> is 1:</p>
17551
17664
17552
- <dt><kbd><kbd>Shift</kbd> + <kbd>→ Right</kbd></kbd>
17553
- <dd>Go to next section, including subsections of the current section
17665
+ <pre><code class="html" data-x=""><!DOCTYPE HTML>
17666
+ <html lang=en>
17667
+ <title>Alphabetic Fruit</title>
17668
+ <section>
17669
+ <h2>Apples</h2>
17670
+ <p>Pomaceous.</p>
17671
+ <h2>Bananas</h2>
17672
+ <p>Edible.</p>
17673
+ <h2>Carambola</h2>
17674
+ <p>Star.</p>
17675
+ </section></code></pre>
17676
+ </div>
17554
17677
17555
- <dt><kbd><kbd>Shift</kbd> + <kbd>↑ Up</kbd></kbd>
17556
- <dd>Go to parent section of the current section
17678
+ <div class="example">
17679
+ <p>The following example is non-conforming as the first <span
17680
+ data-x="concept-heading">heading</span>'s <span>heading level</span> is not 1:</p>
17557
17681
17558
- <dt><kbd><kbd>Shift</kbd> + <kbd>↓ Down</kbd></kbd>
17559
- <dd>Go to next section, skipping subsections of the current section
17560
- </dl>
17682
+ <pre><code class="html" data-x=""><!DOCTYPE HTML>
17683
+ <html lang=en>
17684
+ <title>Feathers on The Site of Encyclopedic Knowledge</title>
17685
+ <h2>A plea from our caretakers</h2>
17686
+ <p>Please, we beg of you, send help! We're stuck in the server room!</p>
17687
+ <h1>Feathers</h1>
17688
+ <p>Epidermal growths.</p></code></pre>
17689
+ </div>
17561
17690
17562
- <p>Plus in addition, the user agent could map the <kbd><kbd>j</kbd></kbd> and
17563
- <kbd><kbd>k</kbd></kbd> keys to navigating to the previous or next element of <span>heading
17564
- content</span>, regardless of the section's outline depth and ignoring sections with no
17565
- headings.</p>
17691
+ <div class="example">
17692
+ <p><code>header</code> elements do not influence the <span>document headings</span> of a
17693
+ document:</p>
17566
17694
17567
- </div>
17695
+ <pre><code class="html" data-x=""><!DOCTYPE HTML>
17696
+ <html lang="en">
17697
+ <title>We're adopting a child! — Ray's blog</title>
17698
+ <h1>Ray's blog</h1>
17699
+ <article>
17700
+ <header>
17701
+ <nav>
17702
+ <a href="?t=-1d">Yesterday</a>;
17703
+ <a href="?t=-7d">Last week</a>;
17704
+ <a href="?t=-1m">Last month</a>
17705
+ </nav>
17706
+ <h2>We're adopting a child!</h2>
17707
+ </header>
17708
+ <p>As of today, Janine and I have signed the papers to become
17709
+ the proud parents of baby Diane! We've been looking forward to
17710
+ this day for weeks.</p>
17711
+ </article>
17712
+ </html></code></pre>
17568
17713
17714
+ <p>The document's <span>document headings</span> could be presented as follows:</p>
17715
+
17716
+ <ol class="brief">
17717
+ <li> Ray's blog
17718
+ <ol class="brief">
17719
+ <li> We're adopting a child!
17720
+ </ol>
17721
+ </ol>
17722
+ </div>
17569
17723
17570
17724
17571
17725
<h4>Usage summary</h4>
0 commit comments