§ 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) {
assert.deepEqual(gathered, [

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


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.

§ Why Set not Array and not JSON?

Because of performance reasons.

Previously, we import()ed JSON and exported it as an object value.

Now, we export hardcoded Set, in an object value.

Size evaluation speed is 3187251.38% faster according our built-in perf tests (see perf/ folder in the root of each package in this monorepo):

matching algorithm

§ Licence

MIT opens in a new tab

Copyright © 2010–2020 Roy Revelt and other contributors

Related packages:

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