1.0.6 • Published 7 years ago

svg-node-ts v1.0.6

Weekly downloads
77
License
MIT
Repository
github
Last release
7 years ago

svg-node stable

Tiny module to create an SVG element.

Usage

NPM

createElement(nodeName, document)

Creates a new SVG element named nodeName. For example:

var createNode = require('svg-node')

var svg = createNode('svg')
var rect = createNode('rect')

rect.setAttribute('x', 0)
rect.setAttribute('y', 0)
rect.setAttribute('width', 20)
rect.setAttribute('height', 20)
rect.setAttribute('fill', '#f00')

svg.setAttribute('width', 20)
svg.setAttribute('height', 20)
svg.appendChild(rect)

document.body.appendChild(svg)

If you're working in a weird environment and need to pass in your own document object you can do so using the function's second argument.

License

MIT. See LICENSE.md for details.

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago