Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-to-vdom

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-to-vdom

Converts html into a vtree

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11K
decreased by-58.47%
Maintainers
1
Weekly downloads
 
Created
Source

html-to-vdom Build Status

About

This is yet another library to convert HTML into a vtree. It's used in conjunction with virtual-dom to convert template based views into virtual-dom views.

Note

As of v0.3.0, the VNode and VText classes need to be passed in during library initialization from the virtual-dom module you are using.
This is to reduce incompatibilties you might have due to depending on a different version of virtual-dom than the one this library would use.

Usage

var VNode = require('virtual-dom/vnode/vnode');
var VText = require('virtual-dom/vnode/vtext');

var convertHTML = require('html-to-vdom')({
    VNode: VNode,
    VText: VText
});

var html = '<div>Foobar</div>';

var vtree = convertHTML(html);
var createElement = require('virtual-dom/create-element');
var el = createElement(vTree);
document.body.appendChild(el);

Credits

Thanks to @mattferrin for noticing that promises could be removed from the API and contributing a PR to do so.
Thanks to @tiagorg for contributing a PR for style attribute parsing.

FAQs

Package last updated on 06 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc