Skip to main content

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.

3.2.1 Semantics

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).

The semantics of a page can change over time (for example, modifications made to the markup via Javascript), so a user agent needs to update the document's presentation according to these changes to the document.

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:

  • title
  • lang
  • translate (boolean value)
  • dir
  • dataset (read-only)
  • hidden (boolean)
  • tabIndex
  • accessKey
  • accessKeyLabel
  • contentEditable
  • 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 <img />).
  • 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.

Responses

My blog uses Webmentions. Responses from Mastodon and other sites that send Webmentions will show up here.

No Webmentions have been sent to this post yet.