-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow <div> around each <dt><dd> group in <dl> #1945
Changes from 3 commits
727674c
5f61b69
2807854
e5c0f2d
59ce458
347ae86
663f43a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17812,7 +17812,8 @@ interface <dfn>HTMLLIElement</dfn> : <span>HTMLElement</span> { | |
<dt><span data-x="concept-element-contexts">Contexts in which this element can be used</span>:</dt> | ||
<dd>Where <span>flow content</span> is expected.</dd> | ||
<dt><span data-x="concept-element-content-model">Content model</span>:</dt> | ||
<dd>Zero or more groups each consisting of one or more <code>dt</code> elements followed by one or more <code>dd</code> elements, optionally intermixed with <span>script-supporting elements</span>.</dd> | ||
<dd>Either: Zero or more groups each consisting of one or more <code>dt</code> elements followed by one or more <code>dd</code> elements, optionally intermixed with <span>script-supporting elements</span>.</dd> | ||
<dd>Or: One or more <code>div</code> elements, optionally intermixed with <span>script-supporting elements</span>.</dd> | ||
<dt><span data-x="concept-element-attributes">Content attributes</span>:</dt> | ||
<dd><span>Global attributes</span></dd> | ||
<dt><span data-x="concept-element-dom">DOM interface</span>:</dt><!--TOPIC:DOM APIs--> | ||
|
@@ -17824,9 +17825,12 @@ interface <dfn>HTMLDListElement</dfn> : <span>HTMLElement</span> {};</pre> | |
|
||
<p>The <code>dl</code> element <span>represents</span> an association list consisting of zero or | ||
more name-value groups (a description list). A name-value group consists of one or more names | ||
(<code>dt</code> elements) followed by one or more values (<code>dd</code> elements), ignoring any | ||
nodes other than <code>dt</code> and <code>dd</code> elements. Within a single <code>dl</code> | ||
element, there should not be more than one <code>dt</code> element for each name.</p> | ||
(<code>dt</code> elements, possibly as children of a <code>div</code> element child) followed by | ||
one or more values (<code>dd</code> elements, possibly as children of a <code>div</code> element | ||
child), ignoring any nodes other than <code>dt</code> and <code>dd</code> element children, and | ||
<code>dt</code> and <code>dd</code> elements that are children of <code>div</code> element | ||
children. Within a single <code>dl</code> element, there should not be more than one | ||
<code>dt</code> element for each name.</p> | ||
|
||
<p>Name-value groups may be terms and definitions, metadata topics and values, questions and | ||
answers, or any other groups of name-value data.</p> | ||
|
@@ -17837,28 +17841,50 @@ interface <dfn>HTMLDListElement</dfn> : <span>HTMLElement</span> {};</pre> | |
<p>The order of the list of groups, and of the names and values within each group, may be | ||
significant.</p> | ||
|
||
<p>In order to annotate groups with <span>microdata</span> attributes, or other <span>global | ||
attributes</span> that apply to whole groups, or just for styling purposes, each group in a | ||
<code>dl</code> element can be wrapped in a <code>div</code> element. This does not change the | ||
semantics of the <code>dl</code> element.</p> | ||
|
||
<div w-nodev> | ||
|
||
<p>If a <code>dl</code> element has no <code>dt</code> or <code>dd</code> element children, it | ||
contains no groups.</p> | ||
<p>If a <code>dl</code> element has no <code>dt</code> or <code>dd</code> element children, or if | ||
it has <code>div</code> element children but those have no <code>dt</code> or <code>dd</code> | ||
element children, it contains no groups.</p> | ||
|
||
<p>If a <code>dl</code> element has one or more non-<span data-x="inter-element | ||
whitespace">whitespace</span> <code>Text</code> node children, or has child elements that are | ||
neither <code>dt</code> nor <code>dd</code> elements, all such <code>Text</code> nodes and | ||
elements, as well as their descendants (including any <code>dt</code> or <code>dd</code> | ||
whitespace">whitespace</span> <code>Text</code> node children, or has child elements that are not | ||
<code>dt</code>, <code>dd</code>, or <code>div</code> elements, all such <code>Text</code> nodes | ||
and elements, as well as their descendants (including any <code>dt</code> or <code>dd</code> | ||
elements), do not form part of any groups in that <code>dl</code>.</p> | ||
|
||
<p>If a <code>dl</code> element has one or more <code>dt</code> element children but no | ||
<code>dd</code> element children, then it consists of one group with names but no values.</p> | ||
<p>If a <code>dl</code> element has one or more <code>div</code> elements that in turn have one or | ||
more non-<span data-x="inter-element whitespace">whitespace</span> <code>Text</code> node | ||
children, or has child elements that are not <code>dt</code> or <code>dd</code> elements, all such | ||
<code>Text</code> nodes and elements, as well as their descendants (including any <code>dt</code> | ||
or <code>dd</code> elements), do not form part of any groups in that <code>dl</code>.</p> | ||
|
||
<p>If a <code>dl</code> element has one or more <code>dd</code> element children but no | ||
<code>dt</code> element children, then it consists of one group with values but no names.</p> | ||
<p>If a <code>dl</code> element has one or more <code>dt</code> element children, or one or more | ||
<code>div</code> element children that in turn have one or more <code>dt</code> element children, | ||
but no <code>dd</code> element children and no <code>div</code> element children that in turn have | ||
one or more <code>dd</code> element children, then it consists of one group with names but no | ||
values.</p> | ||
|
||
<p>If a <code>dl</code> element's first <code>dt</code> or <code>dd</code> element child is a | ||
<code>dd</code> element, then the first group has no associated name.</p> | ||
<p>If a <code>dl</code> element has one or more <code>dd</code> element children, or one or more | ||
<code>div</code> element children that in turn have one or more <code>dd</code> element children, | ||
but no <code>dt</code> element children and no <code>div</code> element children that in turn have | ||
one or more <code>dt</code> element children, then it consists of one group with values but no | ||
names.</p> | ||
|
||
<p>If a <code>dl</code> element's last <code>dt</code> or <code>dd</code> element child is a | ||
<code>dt</code> element, then the last group has no associated value.</p> | ||
<p>If a <code>dl</code> element's first <code>dt</code> or <code>dd</code> element child, or first | ||
<code>dt</code> or <code>dd</code> element child of a <code>div</code> element child, in | ||
<span>tree order</span>, is a <code>dd</code> element, then the first group has no associated | ||
name.</p> | ||
|
||
<p>If a <code>dl</code> element's first <code>dt</code> or <code>dd</code> element child, or first | ||
<code>dt</code> or <code>dd</code> element child of a <code>div</code> element child, in | ||
<span>tree order</span>, is a <code>dd</code> element, then the first group has no associated | ||
value.</p> | ||
|
||
<p class="note">When a <code>dl</code> element doesn't match its content model, it is often due to | ||
accidentally using <code>dd</code> elements in the place of <code>dt</code> elements and vice | ||
|
@@ -17898,18 +17924,26 @@ interface <dfn>HTMLDListElement</dfn> : <span>HTMLElement</span> {};</pre> | |
|
||
<p>The following example illustrates the use of the <code>dl</code> element to mark up metadata | ||
of sorts. At the end of the example, one group has two metadata labels ("Authors" and "Editors") | ||
and two values ("Robert Rothman" and "Daniel Jackson").</p> | ||
and two values ("Robert Rothman" and "Daniel Jackson"). This example also uses the | ||
<code>div</code> element around the groups of <code>dt</code> and <code>dd</code> element, to aid | ||
with styling.</p> | ||
|
||
<pre><dl> | ||
<dt> Last modified time </dt> | ||
<dd> 2004-12-23T23:33Z </dd> | ||
<dt> Recommended update interval </dt> | ||
<dd> 60s </dd> | ||
<dt> Authors </dt> | ||
<dt> Editors </dt> | ||
<dd> Robert Rothman </dd> | ||
<dd> Daniel Jackson </dd> | ||
</dl></pre> | ||
<pre><dl> | ||
<div> | ||
<dt> Last modified time </dt> | ||
<dd> 2004-12-23T23:33Z </dd> | ||
</div> | ||
<div> | ||
<dt> Recommended update interval </dt> | ||
<dd> 60s </dd> | ||
</div> | ||
<div> | ||
<dt> Authors </dt> | ||
<dt> Editors </dt> | ||
<dd> Robert Rothman </dd> | ||
<dd> Daniel Jackson </dd> | ||
</div> | ||
</dl></pre> | ||
</div> | ||
|
||
<div class="example"> | ||
|
@@ -17948,6 +17982,64 @@ first matching case):</p> | |
</dl></pre> | ||
</div> | ||
|
||
<div class="example"> | ||
|
||
<p>This example uses <span>microdata</span> attributes in a <code>dl</code> element, together | ||
with the <code>div</code> element, to annotate the ice cream desserts at a French restaurant.</p> | ||
<!-- https://commons.wikimedia.org/wiki/File:Carte_des_desserts_2012_des_cafétérias_Toquenelle_(1).jpg --> | ||
|
||
<pre lang="fr"><dl> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does div need its "contexts in which this element can be used" updated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
<div itemscope itemtype="http://schema.org/Product"> | ||
<dt itemprop="name">Café ou Chocolat Liégeois</dt> | ||
<dd itemprop="offers" itemscope itemtype="http://schema.org/Offer"> | ||
<span itemprop="price">3.50 €</span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
</dd> | ||
<dd itemprop="description"> | ||
2 boules Café ou Chocolat, 1 boule Vanille, sause café ou chocolat, chantilly | ||
</dd> | ||
</div> | ||
|
||
<div itemscope itemtype="http://schema.org/Product"> | ||
<dt itemprop="name">Américaine</dt> | ||
<dd itemprop="offers" itemscope itemtype="http://schema.org/Offer"> | ||
<span itemprop="price">3.50 €</span> | ||
</dd> | ||
<dd itemprop="description"> | ||
1 boule Crème brûlée, 1 boule Vanille, 1 boule Caramel, chantilly | ||
</dd> | ||
</div> | ||
</dl></pre> | ||
|
||
<p>Without the <code>div</code> element the markup would need to use the <code | ||
data-x="attr-itemref">itemref</code> attribute to link the data in the <code>dd</code> elements | ||
with the item, as follows.</p> | ||
|
||
<pre lang="fr"><dl> | ||
<dt itemscope itemtype="http://schema.org/Product" itemref="1-offer 1-description"> | ||
<span itemprop="name">Café ou Chocolat Liégeois</span> | ||
</dt> | ||
<dd id="1-offer" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> | ||
<span itemprop="price">3.50 €</span> | ||
</dd> | ||
<dd id="1-description" itemprop="description"> | ||
2 boules Café ou Chocolat, 1 boule Vanille, sause café ou chocolat, chantilly | ||
</dd> | ||
|
||
<div> | ||
<dt itemscope itemtype="http://schema.org/Product" itemref="2-offer 2-description"> | ||
<span itemprop="name">Américaine</span> | ||
</dt> | ||
<dd id="2-offer" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> | ||
<span itemprop="price">3.50 €</span> | ||
</dd> | ||
<dd id="2-description" itemprop="description"> | ||
1 boule Crème brûlée, 1 boule Vanille, 1 boule Caramel, chantilly | ||
</dd> | ||
</div> | ||
</dl></pre> | ||
|
||
</div> | ||
|
||
<p class="note">The <code>dl</code> element is inappropriate for marking up dialogue. <a | ||
href="#conversations">Examples of how to mark up dialogue</a> are shown below.</p> | ||
|
||
|
@@ -17960,6 +18052,7 @@ first matching case):</p> | |
<dd>None.</dd> | ||
<dt><span data-x="concept-element-contexts">Contexts in which this element can be used</span>:</dt> | ||
<dd>Before <code>dd</code> or <code>dt</code> elements inside <code>dl</code> elements.</dd> | ||
<dd>Before <code>dd</code> or <code>dt</code> elements inside <code>div</code> elements that are children of a <code>dl</code> element.</dd> | ||
<dt><span data-x="concept-element-content-model">Content model</span>:</dt> | ||
<dd><span>Flow content</span>, but with no <code>header</code>, <code>footer</code>, <span>sectioning content</span>, or <span>heading content</span> descendants.</dd> | ||
<dt><span data-x="concept-element-attributes">Content attributes</span>:</dt> | ||
|
@@ -18003,6 +18096,7 @@ first matching case):</p> | |
<dd>None.</dd> | ||
<dt><span data-x="concept-element-contexts">Contexts in which this element can be used</span>:</dt> | ||
<dd>After <code>dt</code> or <code>dd</code> elements inside <code>dl</code> elements.</dd> | ||
<dd>After <code>dt</code> or <code>dd</code> elements inside <code>div</code> elements that are children of a <code>dl</code> element.</dd> | ||
<dt><span data-x="concept-element-content-model">Content model</span>:</dt> | ||
<dd><span>Flow content</span>.</dd> | ||
<dt><span data-x="concept-element-attributes">Content attributes</span>:</dt> | ||
|
@@ -18343,8 +18437,10 @@ included with Exhibit B. | |
<dd><span>Palpable content</span>.</dd> | ||
<dt><span data-x="concept-element-contexts">Contexts in which this element can be used</span>:</dt> | ||
<dd>Where <span>flow content</span> is expected.</dd> | ||
<dd>As a child of a <code>dl</code> element.</dd> | ||
<dt><span data-x="concept-element-content-model">Content model</span>:</dt> | ||
<dd><span>Flow content</span>.</dd> | ||
<dd>If the element is a child of a <code>dl</code> element: one or more <code>dt</code> elements followed by one or more <code>dd</code> elements, optionally intermixed with <span>script-supporting elements</span>.</dd> | ||
<dd>If the element is not a child of a <code>dl</code> element: <span>Flow content</span>.</dd> | ||
<dt><span data-x="concept-element-attributes">Content attributes</span>:</dt> | ||
<dd><span>Global attributes</span></dd> | ||
<dt><span data-x="concept-element-dom">DOM interface</span>:</dt><!--TOPIC:DOM APIs--> | ||
|
@@ -18357,7 +18453,8 @@ interface <dfn>HTMLDivElement</dfn> : <span>HTMLElement</span> {};</pre> | |
<p>The <code>div</code> element has no special meaning at all. It <span>represents</span> its | ||
children. It can be used with the <code data-x="attr-class">class</code>, <code | ||
data-x="attr-lang">lang</code>, and <code data-x="attr-title">title</code> attributes to mark up | ||
semantics common to a group of consecutive elements.</p> | ||
semantics common to a group of consecutive elements. It can also be used in a <code>dl</code> | ||
element, wrapping groups of <code>dt</code> and <code>dd</code> elements.</p> | ||
|
||
<p class="note">Authors are strongly encouraged to view the <code>div</code> element as an element | ||
of last resort, for when no other element is suitable. Use of more appropriate elements instead of | ||
|
@@ -114834,7 +114931,8 @@ interface <dfn>External</dfn> { | |
<th><code>dd</code></th> | ||
<td>Content for corresponding <code>dt</code> element(s)</td> | ||
<td>none</td> | ||
<td><code>dl</code></td> | ||
<td><code>dl</code>; | ||
<code>div</code>*</td> | ||
<td><span data-x="Flow content">flow</span></td> | ||
<td><span data-x="global attributes">globals</span></td> | ||
<td><code>HTMLElement</code></td> | ||
|
@@ -114894,10 +114992,11 @@ interface <dfn>External</dfn> { | |
|
||
<tr> | ||
<th><code>div</code></th> | ||
<td>Generic flow container</td> | ||
<td>Generic flow container, or container for name-value groups in <code>dl</code> elements</td> | ||
<td><span data-x="Flow content">flow</span>; | ||
<span data-x="Palpable content">palpable</span></td> | ||
<td><span data-x="Flow content">flow</span></td> | ||
<td><span data-x="Flow content">flow</span>; | ||
<code>dl</code></td> | ||
<td><span data-x="Flow content">flow</span></td> | ||
<td><span data-x="global attributes">globals</span></td> | ||
<td><code>HTMLDivElement</code></td> | ||
|
@@ -114911,6 +115010,7 @@ interface <dfn>External</dfn> { | |
<td><span data-x="Flow content">flow</span></td> | ||
<td><code>dt</code>*; | ||
<code>dd</code>*; | ||
<code>div</code>*; | ||
<span>script-supporting elements</span></td> | ||
<td><span data-x="global attributes">globals</span></td> | ||
<td><code>HTMLDListElement</code></td> | ||
|
@@ -114920,7 +115020,8 @@ interface <dfn>External</dfn> { | |
<th><code>dt</code></th> | ||
<td>Legend for corresponding <code>dd</code> element(s)</td> | ||
<td>none</td> | ||
<td><code>dl</code></td> | ||
<td><code>dl</code>; | ||
<code>div</code>*</td> | ||
<td><span data-x="Flow content">flow</span>*</td> | ||
<td><span data-x="global attributes">globals</span></td> | ||
<td><code>HTMLElement</code></td> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking of replacing these paragraphs with an algorithm for how to get the groups of a
dl
element, since right now they are probably a bit confusing and not so helpful if someone wants to actually get the groups of adl
element (in an HTML scraping tool for example).My thinking is that the algorithm should be something like this:
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4601