0.0.1 • Published 8 years ago

frag-factory v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
8 years ago

Frag Factory

Frag Factory is a small helper for constructing DOM fragments from simple objects.

Usage

var FragFactory = require('frag-factory');

var fragment = FragFactory.create([
  {
    tag: 'img',
    src: 'http://www.ntnusymbiosis.com/wp-content/uploads/2011/09/thumbs-up.jpg',
    width: 200
  },
  {
    tag: 'a',
    href: 'https://awesome-site.io',
    text: "Let's go there!",
    style: 'display:block; font-size:1.5em; text-decoration:none;'
  },
  {
    tag: 'ul',
    children: [
      {
        tag: 'li',
        text: "It's just one thing"
      },
      {
        tag: 'li',
        text: "After the other"
      }
    ]
  }
]);

document.getElementById('app').appendChild(fragment);