virtual-dom-lite
A partial implementation of virtual-dom
3 separate modules á 200 bytes.*
Perfect for libraries.
* Transpiled to ES5 and minzipped, the last time I checked.
⚠ Heads up! This is totally a work in progress. Thoughts and ideas are very welcome.
Installation
$ npm install virtual-dom-lite
Usage
- Import the module:
;
– or in ES5:
var virtualDOMLite = ; var patchElement = virtualDOMLitepatchElement;var vNode = virtualDOMLitevNode;var vPatch = virtualDOMLitevPatch;
- Profit!
const div = document; const vDiv = ; // Compatible with virtual-dom as well!const patch = ; // Compatible with virtual-dom as well! ;divouterHTML;//» '<div class="a b c"></div>'
Caveats
vNode
and patchElement
only support the attributes
property. vPatch
only sets attributes. If you construct your diffs using virtual-dom, remember about it:
const diff h = ; ; // Won’t work. ; // Works!