Day 35 of 100DaysOfSpec, 3.2 Elements
I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft's official opinion of the spec. Subsections not listed below were read without comment.
Currently reading in 3.2 Elements.
Elements, attributes, and attribute values have meaning! Allows browsers, search engines, and other HTML processors to know how to present HTML documents. I like how the example lingers on how semantic markup is meaningful for accessibility (speech-based screen readers).
3.2.2 Elements in the DOM
The spec requires implementation of the HTML elements listed in the spec, and all these elements need to be accessible to scripting languages.
All element interfaces (I think this is being used as a synonym for API?) inherit from the HTMLElement interface. Some elements don't have any other requirements for implementation outside of this root interface. Not quite sure of an example there, as they are not given, but I wonder if the
span element has no further requirements, being a pretty semantically-vague element. This being the spec, though, I wouldn't be surprised if there were another 8 different rules about how to process a span.
The HTMLUnknownElement interface is used for non-spec-defined elements.
Attributes in the main interface include:
- translate (boolean value)
- dataset (read-only)
- hidden (boolean)
- isContentEditable (boolean)
- spellcheck (boolean)
3.2.3 Element definitions
This section details what-to-expect from element definitions, which include:
- The element's categories: used for defining the element's content models.
- Contexts in which this element can be used: can be redundant info to content model.
- Content model: rules on which elements need to be included as children/descendents.
- Tag omission in text/html: defines when an element's tag can be self-closing (like an
- Content attributes: attributes that can set on the element; some are normative (required by spec, listed first), and some are not.
- DOM interface
Unless restrictions are listed, attributes can contain any text value.