html-element-attributes
Map of HTML elements to allowed attributes
Last updated 4 years ago by wooorm .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install html-element-attributes 
SYNC missed versions from official npm registry.

html-element-attributes

Build Coverage Downloads Size

Map of HTML elements to allowed attributes.

Contents

What is this?

This is a map of tag names to lists of allowed attributes. Global attributes are stored at the special tag name *. All attributes from HTML 4 and the current living HTML spec are included.

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

When should I use this?

You can use this to figure out if certain attributes are allowed on certain HTML elements.

Install

This package is ESM only. In Node.js (version 12.20+, 14.14+, or 16.0+), install with npm:

npm install html-element-attributes

In Deno with Skypack:

import {htmlElementAttributes} from 'https://cdn.skypack.dev/html-element-attributes@3?dts'

In browsers with Skypack:

<script type="module">
  import {htmlElementAttributes} from 'https://cdn.skypack.dev/html-element-attributes@3?min'
</script>

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

Map of lowercase HTML elements to allowed attributes (Record<string, Array<string>>).

Types

This package is fully typed with TypeScript.

Compatibility

This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, and 16.0+. It also works in Deno and modern browsers.

Security

This package is safe.

Related

Contribute

Yes please! See How to Contribute to Open Source.

License

MIT © Titus Wormer

Current Tags

  • 3.1.0                                ...           latest (4 years ago)

12 Versions

  • 3.1.0                                ...           4 years ago
  • 3.0.0                                ...           5 years ago
  • 2.3.0                                ...           5 years ago
  • 2.2.1                                ...           6 years ago
  • 2.2.0                                ...           6 years ago
  • 2.1.0                                ...           7 years ago
  • 2.0.0                                ...           8 years ago
  • 1.3.1                                ...           8 years ago
  • 1.3.0                                ...           9 years ago
  • 1.2.0                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 12
Dependencies (0)
None
Dev Dependencies (18)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |