yoshuawuyts / Virtual Html
🌴 HTML → virtual-dom
Stars: ✠175
Programming Languages
javascript
184084 projects - #8 most used programming language
virtual-html
Convert given HTML into Virtual DOM object
Install
$ npm install virtual-html
Usage
Async:
var html = '<div class="foo bar" style="color: red; background: yellow;" data-yo="123">yo</div>';
var virtual = require('virtual-html')
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('virtual-html')
// synchronous interface
var dom = virtual(html)
dom.tagName
// => 'div'
dom.children[0].text
// => 'yo'
dom.properties.dataset.yo
// => 123
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].