w3ctag / design-principles

A small-but-growing set of design principles collected by the TAG while reviewing specifications
https://w3ctag.github.io/design-principles
174 stars 46 forks source link

HTML: Guidance about lists of values in attributes #277

Open LeaVerou opened 3 years ago

LeaVerou commented 3 years ago

This relates to #269.

For short lists of values, current practice is to use a space or comma separated attribute. Examples:

For larger lists of values, embedding the list in an attribute should be discouraged. Instead, current practice is to link to another element (e.g. <input list>) or to declare the list using child elements, if this is an essential part of the element (e.g. the list of <option> elements inside <select>).

cynthia commented 3 years ago

Similar to what #278, this probably should touch on how the attribute is exposed to the DOM, and also for APIs that accept sequences. (and how interop is expected to work - className ergonomics is probably and example that would work as an antipattern.)

plinss commented 2 years ago

See also #270

LeaVerou commented 2 years ago

Consensus from today's breakout: