Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
DOMinate for node.js and browserify
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
browser.js
index.js
package.json
test.js

README.md

DOMinate

Generate html from a simple array based JavaScript representation

Build Status Dependency Status NPM version

Installation

$ npm install dominate

Example

var DOMinate = require('dominate');
DOMinate(
    ['div',
      ['h1#logo', 'Static Example', {style:'color:blue'}],
      ['p','some example text'],
      ['ul', {id:'list', class:'bullets'},
        ['li', 'item1'],
        ['li.active', 'item2'],
        ['li',
          ['a', 'item3', {href: '#'}]
        ]
      ]
    ]
  );

On the server side this returns the string:

<div><h1 id="logo" style="color:blue">Static Example</h1><p>some example text</p><ul id="list" class="bullets"><li>item1</li><li class="active">item2</li><li><a href="#">item3</a></li></ul></div>

On the client side it returns the DOM element

<div>
  <h1 id="logo" style="color:blue">Static Example</h1>
  <p>some example text</p>
  <ul id="list" class="bullets">
    <li>item1</li>
    <li class="active">item2</li>
    <li><a href="#">item3</a></li>
  </ul>
</div>

License

MIT

Something went wrong with that request. Please try again.