svg-create-element
v1.0.0
Published
create an svg element
Downloads
588
Maintainers
Readme
svg-create-element
create an svg element
example
var createElement = require('svg-create-element');
var svg = createElement('svg');
svg.appendChild(createElement('polyline', {
stroke: 'cyan',
strokeWidth: 4,
fill: 'transparent',
points: [ [ 5, 50 ], [ 450, 100 ], [ 300, 300 ], [ 150, 220 ] ].join(' ')
}));
document.body.appendChild(svg);
methods
var createElement = require('svg-create-element')
var elem = createElement(name, attr)
Create a new svg dom element elem
named by the string name
.
Optionally you can set attributes on the newly-created element by supplying
attr
mappings. Camel-cased attr
keys will automatically be converted to
hypthenated names.
install
With npm do:
npm install svg-create-element
license
MIT