Coder Social home page Coder Social logo

vdom's Introduction

vdom

A DOM render and patch algorithm for vtree

Please note that this now lives under https://github.com/Matt-Esch/virtual-dom and all related issues shoud be opened there. This repository will eventually become a build artifact of virtual-dom for developers with an advanced usage pattern.

Motivation

Given a vtree structure representing a DOM structure, we would like to either render the structure to a DOM node using vdom/create-element or we would like to update the DOM using the results of vtree/diff by patching the DOM with vdom/patch

This module is currently re-exporting the vdom from virtual-dom, but the aim is to eventually make this a standalone module and have virtual-dom depend on vdom instead.

Example

var VNode = require("vtree/vnode")
var diff = require("vtree/diff")

var createElement = require("vdom/create-element")
var patch = require("vdom/patch")

var leftNode = new VNode("div")
var rightNode = new VNode("text")

// Render the left node to a DOM node
var rootNode = createElement(leftNode)
document.body.appendChild(rootNode)

// Update the DOM with the results of a diff
var patches = diff(leftNode, rightNode)
patch(rootNode, patches)

Installation

npm install vdom

Contributors

  • Matt Esch

MIT Licenced

vdom's People

Contributors

matt-esch avatar neonstalwart avatar raynos avatar uberesch avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.