4 HTML Concepts You Didn’t Know
by @j9t@mas.to on , tagged html, concepts, tables (toot this?)
HTML is so important, large, and complex, it warrants a pilgrimage. The specification includes many gems, whether it’s dark humor or esoteric edge cases. It also contains concepts that not everyone is familiar with. Borrowing from the “HTML Concepts” series on meiert.com, here are four of them.
1. “Body-Ok”
“Body-ok” relates to link type keywords, and denotes what link
elements are okay to be used in the document body (as opposed to its head).
2. The “Nothing” Content Model
“When an element’s content model is nothing, the element must contain no Text
nodes (other than inter-element whitespace) and no element nodes.” Most HTML elements whose content model is “nothing” are also, for convenience, void elements. (The template
element is an exception.)
3. Constraint Validation
When a form element (like input
) has attributes that define requirements for the element’s value (like being required
, or setting a minlength
, or following a pattern
), then these requirements (constraints) are being validated by the user agent. Constraints are being validated as long as the element is not barred from it.
4. Indicators for Layout Tables
In order to navigate a table, user agents “are encouraged to find heuristics to determine which tables actually contain data and which are merely being used for layout.” The HTML spec then offers a few heuristics. For example, if there’s a role
attribute with a value of presentation
, a border
attribute with a (non-conforming) value of 0
, or if there are (also non-conforming) cellspacing
and cellpadding
attributes with a value of 0
, a table is—probably a layout table.
—Now you know more, when you hear about “body-ok,” the “nothing” content model, constraint validation, and indicators for layout tables. To be continued.