-
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
Conversation
This only changes the content model and the rules for determining what a dl element represents. Fixes #1937.
@@ -17960,6 +17991,7 @@ first matching case):</p> | |||
<dd>None.</dd> |
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -18344,7 +18377,8 @@ included with Exhibit B. | |||
<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><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--> |
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.
Should we update the short paragraph describing the div element, and the note describing it as an element of last resort?
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 updated the description, but not the note. I don't want to tweak div
itself so much in this PR, that seems like a separate issue.
I guess we should also put updating the FAQ as an action item after this is merged :) |
Also mention dl in the div section. Also mention div in dl's description of the name-value groups.
<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 |
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 a dl
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
This should be editorial. Hopefully clearer and more helpful.
See whatwg/html#1945 This passes the tests in web-platform-tests/wpt#4053 Note that `<dl><script></script></dl>` previously resulted in an error; now has no errors.
<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 comment
The reason will be displayed to describe this comment to others. Learn more.
Use the priceCurrency property (with ISO 4217 codes e.g. "USD") instead of including ambiguous symbols such as '$' in the value.
Also remove `div` from the supposedly-divless example.
See whatwg/html#1945 This passes the tests in web-platform-tests/wpt#4053 Note that `<dl><script></script></dl>` previously resulted in an error; now has no errors.
Why would you want to allow |
@gunnarbittersmann I suggest you read through #1937. Lots of alternatives were considered. |
According to the HTML5.org’s Nu Html Checker, looks like we still cannot use multiple nested
If this is intentional (hopefully not), this is a huge limitation that makes the feature much less useful. |
It's intentional, see #1937 (comment) |
@zcorpan Thanks, Simon. That’s a real shame. I was intending to adopt the feature, but now I’m forced to switch back to the previously used Could you explain why exactly in practice (besides just an intent to make the content model as strict and simple as possible) using more than one I believe there is nothing that makes this:
less possible than this:
(Please let me know if it’s more appropriate to discussing this in the thread you’ve referred to). |
I was not aware of use cases that required multiple nested elements (I don't recall it being stated as a requirement in #1937), and so went with the strict and simple approach. Why do you need multiple elements? Can you point to something where you currently use Allowing arbitrary nested |
I use
Complicating conformance checkers is probably a minor thing. And actually, complication is obviously quite little.
Quite the contrary, it was always possible to nest multiple
Given that |
This only changes the content model and the rules for determining what a dl element represents. Fixes whatwg#1937.
This only changes the content model and the rules for determining
what a dl element represents.
Fixes #1937.