A set of functions for the snabbdom virtualdom library
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist
src
.babelrc Initial commit Apr 15, 2016
.eslintrc.js
.gitignore
.travis.yml
CONDUCT.md
LICENSE.md
README.md Renaming properties [fixes #1] (#4) May 25, 2016
package.json

README.md

snabbdom-helpers

Quality Coverage Build Releases License

A set of functions that maps to the entire list of the W3C DOM elements. Each function returns a snabbdom object.

Here's how you use it (patch and vdom comes from snabbdom):

import {article} from "snabbdom-helpers"
import {h1} from "snabbdom-helpers"
import {p} from "snabbdom-helpers"

// ... snabbdom setup ...

const newVirtualDom = article({
  data: {id: "1"},
  inner: [
    h1({
      style: {color: "blue"},
      inner: "Hello"
    }),
    p({selector: ".red.body", inner: "World!"})
  ]
})

patch(vdom, newVirtualDom)

It should output (minus white-spacing):

<article data-id="1">
  <h1 style="color: blue;">Hello</h1>
  <p class="red body">
    World!
  </p>
</article>

installing

To install just grab from npm:

$ npm install --save snabbdom-helpers

Add it into your project (with require() and import ... from "snabbdom-helpers").

contributing

  1. Read the Code of Conduct
  2. Fork it
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request