Socket
Book a DemoInstallSign in
Socket

dominate

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dominate

DOMinate for node.js

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 08 Jul 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts