0.1.1 • Published 6 years ago

picodom-stringify v0.1.1

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
6 years ago

picodom-stringify

Convert the object created with picodom h into an HTML string.

It's similar to hyperapp-stringify but picodom uses a slightly different object representation than hyperapp.

var pstr = require('picodom-stringify')
var h = require('picodom').h

// simple node
var vnode = h('div', {}, 'hi')
pstr(vnode)
// <div>hi</div>

// input with event handler
vnode = h('input', {type: 'text', onfocus: function(){alsert('hi!!')}})
pstr(vnode)
// <input type="text">
// notice nothing happens for event handlers. it just skips it

vnode = h('div', {style: {border: '1px solid red'}}, 'red outline box')
pstr(vnode)
// <div style="border:1px solid red;">red outline box</div>
// it can work through how to translate the style attribute

Development

npm test # simple node `assert` test

It has one dependency, self-closing-tags which is very minimal.

Known issue is -o- Opera prefix.

0.1.1

6 years ago