A TypeScript library for working with the HTML Living Standard specification.
⚠️ Experimental: This project may introduce breaking changes frequently.
npm install html-standardimport { element } from "html-standard";
// Basic elements
element("button").implicitRole(); // 'button'
element("nav").implicitRole(); // 'navigation'
// Attribute-dependent roles
element("a", {
attributes: { get: (key) => (key === "href" ? "https://example.com" : null) },
}).implicitRole(); // 'link'
element("a").implicitRole(); // 'generic' (no href)
element("input", {
attributes: { get: (key) => (key === "type" ? "checkbox" : null) },
}).implicitRole(); // 'checkbox'import { element } from "html-standard";
const link = element("link");
// Validate 'rel' attribute
link.attributes.get("rel")?.validateValue("stylesheet"); // { valid: true, ... }
link.attributes.get("rel")?.validateValue("invalid-value"); // { valid: false, ... }- Implicit ARIA roles per HTML-ARIA spec
- Attribute validation based on HTML Standard
- Case-insensitive element names
- TypeScript support
MIT