hea

html-element-attributes

Map of HTML elements to allowed attributes

Showing:

Popularity

Downloads/wk

102K

GitHub Stars

31

Maintenance

Last Commit

6mos ago

Contributors

1

Package

Dependencies

0

Size (min+gzip)

1.6KB

License

MIT

Type Definitions

Built-In

Tree-Shakeable

No?

Categories

Readme

html-element-attributes

Build Coverage Downloads Size

Map of HTML elements to allowed attributes. Also contains global attributes under '*'. Includes attributes from HTML 4 and HTML (the WHATWG living standard).

Note: Includes deprecated attributes.

Note: Attributes which were not global in HTML 4 but are in HTML, are only included in the list of global attributes.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install html-element-attributes

Use

import {htmlElementAttributes} from 'html-element-attributes'

console.log(htmlElementAttributes['*'])
console.log(htmlElementAttributes.ol)

Yields:

[
  'accesskey',
  'autocapitalize',
  'autofocus',
  'class',
  // …
  'style',
  'tabindex',
  'title',
  'translate'
]
['compact', 'reversed', 'start', 'type']

API

This package exports the following identifiers: htmlElementAttributes. There is no default export.

htmlElementAttributes

Object.<string, string[]> — Map of lowercase tag names to an array of lowercase attribute names.

The object contains one special key: '*', which contains global attributes that apply to all HTML elements.

License

MIT © Titus Wormer

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100