svg-element-attributes
Map of SVG elements to allowed attributes.
Also contains global attributes under '*'
.
Includes attributes from SVG 1.1, SVG Tiny 1.2, and SVG 2.
Note: Does not include ARIA attributes (role
, aria-*
), xml:*
or
xlink:*
attributes, event attributes (on*
), or ev:event
.
Install
This package is ESM only: Node 12+ is needed to use it and it must be import
ed
instead of require
d.
npm:
npm install svg-element-attributes
Use
import {svgElementAttributes} from 'svg-element-attributes'
console.log(svgElementAttributes['*'])
console.log(svgElementAttributes.circle)
Yields:
[
'about',
'class',
'content',
'datatype',
'id',
'lang',
'property',
'rel',
'resource',
'rev',
'tabindex',
'typeof' ]
[
'alignment-baseline',
'baseline-shift',
'clip',
'clip-path',
'clip-rule',
'transform',
'unicode-bidi',
'visibility',
'word-spacing',
'writing-mode' ]
API
This package exports the following identifiers: svgElementAttributes
.
There is no default export.
svgElementAttributes
Object.<Array.<string>>
— Map of tag names to an array of attribute names.
The object contains one special key: '*'
, which contains global attributes
that apply to all SVG elements.
License
MIT © Titus Wormer