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
.
Installation
npm:
npm install svg-element-attributes
Usage
var svgElementAttributes = require('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',
'cx',
'cy',
'externalResourcesRequired',
'focusHighlight',
'focusable',
'nav-down',
'nav-down-left',
'nav-down-right',
'nav-left',
'nav-next',
'nav-prev',
'nav-right',
'nav-up',
'nav-up-left',
'nav-up-right',
'pathLength',
'r',
'requiredExtensions',
'requiredFeatures',
'requiredFonts',
'requiredFormats',
'style',
'systemLanguage',
'transform' ]
API
svgElementAttributes
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 SVG elements.
License
MIT © Titus Wormer