Skip to content

Extension · md-clock

Name: md-clockVersion: 1.0.0 Context: inline (non-event) Content model: leaf (no children)

Motivation

Display a live-ticking clock rendered by the runtime. A demonstration extension illustrating the §9 extension mechanism and the §12.2 state-preservation contract.

Syntax

<md-clock timezone="UTC" format="24h"/>

Self-closing form only. Open/close form is NOT recognized.

Attributes

NameValue grammarDefaultNormative
timezoneIANA timezone name (e.g., UTC, Europe/Moscow)UTCNormative
format12h / 24h24hNormative

All other attributes are silently dropped per §10.3.3.

Semantics

The rendered DOM is:

html
<md-clock data-timezone="UTC" data-format="24h">
  <time datetime="..." aria-live="polite">HH:MM:SS</time>
</md-clock>

The renderer MUST update the <time> element's textContent at least every 1000ms. Updates MUST NOT create new DOM nodes (state preservation).

Identity & state preservation

md-clock is an interactive element. Its identity for re-render reuse follows §12.2.3: prefer id, else data-key, else source-position.

Security

md-clock has no URL attributes, no executable content, and no user-input attributes. It is trivially compatible with §10 Security Model.

Test vectors

Vectors live under packages/spec-tests/src/vectors/extensions/md-clock/. Required coverage:

  • Default attributes.
  • timezone and format attributes honored.
  • Invalid timezone produces an error sentinel per §11.4.2.
  • State preservation across re-render.

Governance

Changes to this extension follow the MdFlow governance process (Governance) and are versioned independently of core.