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');
var globals = svgElementAttributes['*'];
Yields:
[ 'class',
'content',
'datatype',
'id',
'property',
'rel',
'resource',
'rev',
'typeof',
'lang',
'tabindex' ]
Attributes on the circle
element:
var circle = svgElementAttributes.circle;
Yields:
[ 'cx',
'cy',
'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',
'r',
'requiredExtensions',
'requiredFeatures',
'requiredFonts',
'requiredFormats',
'systemLanguage',
'transform',
'alignment-baseline',
'externalResourcesRequired',
'style',
'pathLength' ]
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