# virtualdom2

> A virtual DOM library with focus on simplicitymodularity, powerful features and performance.

Latest version **1.0.1** (published 2020-10-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install virtualdom2
pnpm add virtualdom2
yarn add virtualdom2
bun add virtualdom2
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-10-17 |
| First published | 2020-10-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 53.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 1254765721@qq.com |
| Maintainers | moshenggui |
| Keywords | virtual, dom, vm, diff, patch, vue, snabbdom, react |

## Links

- npm: https://www.npmjs.com/package/virtualdom2
- Repository: https://gitee.com/zhkumsg/virtualdom
- Homepage: http://wiki.crqcn.com/vue/virtualdom-self.html
- npm.io page: https://npm.io/package/virtualdom2

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-10-17
- 1.0.0 — 2020-10-14

## README

# Virtual dom

## Install

```bash
npm install virtualdom2 --save
```

### Or use cdn

```html
<script src="xxx/xxx/virtualdom2/dist/index.umd.js"></script>
```

## Useage

```html
<div class="app"></div>
```

```js
const { createVNode: h, patch } = new Virtualdom();

let vnode = h('div', { attrs: { class: 'app' } }, [
    h('h1', {}, [
        h('text', { attrs: { textContent: 'Hi, Virtual Dom' } })
    ])
]);

let oldVNode = patch(document.querySelector('.app'), vnode); // first view

setTimeout(() => {
    vnode = h('div', { attrs: { class: 'app', style: 'text-align:center' } }, [
        h('h1', { attrs: { style: 'color:red' } }, [
            h('text', { attrs: { textContent: 'Hi, Virtual Dom' } })
        ]),
        h('p', {}, [
            h('text', { attrs: { textContent: 'A virtual DOM library with focus on simplicitymodularity, powerful features and performance.' } })
        ])
    ]);
    oldVNode = patch(oldVNode, vnode); // last view
}, 2000)
```

---
_Source: https://npm.io/package/virtualdom2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
