Package Exports
- to-vdom
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (to-vdom) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
virtual-html
Convert given HTML/DOM into Virtual DOM object
Install
$ npm install to-vdom
Usage
Async:
var html = '<div class="foo bar" style="color: red; background: yellow;" data-yo="123">yo</div>';
// ^ Could be a DOM object as well.
var virtual = require('to-vdom')
virtual(html, function (error, dom) {
if (error) throw error
dom.tagName
// => 'div'
dom.children[0].text
// => 'yo'
dom.properties.dataset.yo
// => 123
})
Sync:
var html = '<div class="foo bar" style="color: red; background: yellow;" data-yo="123">yo</div>';
var virtual = require('to-vdom')
// synchronous interface
var dom = virtual(html)
dom.tagName
// => 'div'
dom.children[0].text
// => 'yo'
dom.properties.dataset.yo
// => 123