html-standard
A TypeScript library for working with the HTML Living Standard specification.
Last updated 9 months ago by yeonjuan-joah .
MIT · Original npm · Tarball · package.json
$ npm install html-standard 
SYNC missed versions from official npm registry.

html-standard

A TypeScript library for working with the HTML Living Standard specification.

⚠️ Experimental: This project may introduce breaking changes frequently.

Installation

npm install html-standard

Usage

Get Implicit ARIA Roles

import { 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'

Validate Attributes

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, ... }

Features

  • Implicit ARIA roles per HTML-ARIA spec
  • Attribute validation based on HTML Standard
  • Case-insensitive element names
  • TypeScript support

License

MIT

Current Tags

  • 0.0.13                                ...           latest (9 months ago)

13 Versions

  • 0.0.13                                ...           9 months ago
  • 0.0.12                                ...           9 months ago
  • 0.0.11                                ...           9 months ago
  • 0.0.10                                ...           9 months ago
  • 0.0.9                                ...           10 months ago
  • 0.0.8                                ...           10 months ago
  • 0.0.7                                ...           10 months ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Total 24
Today 0
This Week 0
This Month 12
Last Day 0
Last Week 0
Last Month 1
Dev Dependencies (4)

© 2010 - cnpmjs.org x YWFE | Home | YWFE