Skip to content

Files

Latest commit

b1971a5 · Nov 7, 2016

History

History
91 lines (65 loc) · 1.6 KB

readme.md

File metadata and controls

91 lines (65 loc) · 1.6 KB

html-element-attributes Build Status

Map of HTML elements to allowed attributes. Also contains global attributes under '*'. Includes attributes from HTML 4, W3C HTML 5, and WHATWG HTML 5.

Note: Includes deprecated attributes.

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

Installation

npm:

npm install html-element-attributes

Usage

var htmlElementAttributes = require('html-element-attributes');

var globals = htmlElementAttributes['*'];

Yields:

[ 'accesskey',
  'class',
  'contenteditable',
  'contextmenu',
  'dir',
  'draggable',
  'dropzone',
  'hidden',
  'id',
  'is',
  'itemid',
  'itemprop',
  'itemref',
  'itemscope',
  'itemtype',
  'lang',
  'slot',
  'spellcheck',
  'style',
  'tabindex',
  'title',
  'translate' ]

Attributes on the ol element:

var ol = htmlElementAttributes.ol;

Yields:

[ 'compact', 'reversed', 'start', 'type' ]

API

htmlElementAttributes

Object.<Array.<string>> — Map of lower-case tag-names to an array of lower-case attribute names.

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

License

MIT © Titus Wormer