1.0.5 • Published 12 years ago

HuK v1.0.5

Weekly downloads
32
License
-
Repository
github
Last release
12 years ago

huk

Generate HTML code in javascript simply with this module using browserify.

npm install huk-browserify
var $ = require('huk');

var button = $.button('Click!');
$()
  .header({ 'class': 'foo' }, 'Header')
  .footer({ id: 'bar' })
  .appendTo(domElement)
;

create an element

simple element

// $.<HTMLTagName>(<Attributes>, <Content>);

// creating only with attributes
// attributes are just simple Object key-value pairs
$.b({ id: 'foo' });

// if the first argument isn't an Object it will be the content
// content can be a String/Number/DOM element
$.i('bar');

// first argument are the attributes
// second argument is the content
$.strong({ id: 'foo' }, 'bar');

multiple element

$()
  .header('foo')
  .section('bar')
  .footer('BOO')
.appendTo(domElement);
  • .appendTo(domElement), .prependTo(domElement): Use them at the and of the chain
  • .text(String): creating a text node
  • .customElement(elementName, attributes, content): creating a custom element
1.0.5

12 years ago

1.0.4

12 years ago

1.0.3

12 years ago

1.0.2

12 years ago

1.0.1

12 years ago

1.0.0

12 years ago