Quick Take

import { strict as assert } from "assert";
import { allHtmlAttribs } from "html-all-known-attributes";

assert.equal(allHtmlAttribs.has("href"), true);

assert.equal(allHtmlAttribs.size, 702);

// iterating:
const gathered = [];
for (const x of allHtmlAttribs) {
  // push first three
  if (gathered.length < 3) {
    gathered.push(x);
  }
}
assert.deepEqual(gathered, [
  "abbr",
  "accept",
  "accept-charset",
]);

Idea

This package aims to have the most excessive list of all legit attribute names that can be put into HTML. Currently we have a list of 702 attribute names.

This includes deprecated attributes, Microsoft-proprietary-ones that email templates use (like mso-line-height-rule) and other-ones you've probably never seen before.

API

allHtmlAttribs

This package exports a plain object with a single key, allHtmlAttribs. Its value is a Set opens in a new tab of 702 strings — all HTML attribute names known to the Humanity.

Changelog

See it in the monorepo opens in a new tab, on GitHub.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub opens in a new tab.

Any code contributions welcome! All Pull Requests will be dealt promptly.

Licence

MIT opens in a new tab

Copyright © 2010–2021 Roy Revelt and other contributors

Related packages:

📦 html-img-alt 2.1.0
Adds missing alt attributes to img tags. Non-parsing
📦 html-crush 4.2.0
Minifies HTML/CSS: valid or broken, pure or mixed with other languages
📦 html-entities-not-email-friendly 0.5.0
All HTML entities which are not email template friendly
📦 html-table-patcher 4.1.0
Visual helper to place templating code around table tags into correct places