Skip to content

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

Notifications You must be signed in to change notification settings

mushishi78/frag-factory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published