DefinitionGrouping

From HTML WG Wiki
Jump to: navigation, search

Grouping in Definition Lists

State: NEW ISSUE

Definition lists (`dl` elements) do not allow the associations between terms and definitions to be explicitly indicated in markup and the DOM.

Possible uses:

  1. Styling of definition groups using CSS.
  2. Making the existing grouping easier to interpret.
  3. Allowing a term to be placed after its definition.
  4. Applying a class to a whole group in order to add a microformat.
  5. Allowing terms without definitions and vice-versa.

Proposals

  1. Add a `di` ("definition item") element.
    • Spec changes:
      • Add new element.
      • Allow `di` to have only `dt`/`dd` children.
      • Allow `di` elements as children of `dl` (either between `dt`/`dd` groups, or instead of them).
      • Define that all `dd` children of a `di` element are the definitions for the `dt` children.
  2. Pro: allows out-of-order/missing `dd`/`dt`.
    • Pro: allows styling, classing.
    • Con: makes parsing more complicated.
    • Con: doesn't allow marking up of multiple groups.
    • Matches XHTML 2.
  3. Allow nested `dl` elements.
    • Spec changes:
      • Allow `dl` elements as children of `dl` (either between `dt`/`dd` groups, or instead of them).
  4. Pro: allows styling, classing.
    • Pro: allows multiple related `dt`/`dd` groups to be marked up.
    • Con: doesn't allow out-of-order/missing `dd`/`dt`.
    • Con: inconsistent with rules for `ol`/`ul`.
  5. Add `for` attribute to `dd`.
    • Spec changes:
      • Allow `for` attribute on `dd` element.
      • Define that the for attribute on `dd` elements must be the `id` of a `dt` element.
      • Define how this interacts with the implicit model.
  6. Pro: allows association of any `dd` with any `dt`.
    • Con: allows association of any `dd` with any `dt`.
    • Con: complicates parsing.
    • Con: doesn't help with styling issue.
  7. No spec changes.
    • Suggest new pseudo-element selectors to CSS WG.

Research

WHATWG Emails

HTML WG Emails

Other References