Skip to content

ianthekirkland/html-element-attributes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Map of HTML elements to allowed attributes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%