node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


Nofactor is a light DOM API wrapper that's supported in node.js, and in the browser (IE 6+, Chrome, Firefox, Opera, Safari). It's used for DOM creation / manipulation in paperclip.js. Alt ci Coverage Status


var nofactor = require("nofactor"),
// pick the default DOM adapter - node, or browser (thin). 
nostr = nofactor.string; 
var element = nostr.createElement("div"),
element.setAttribute("id", "test");
console.log(element.toString()); //<div id="test"></div> 

Custom Elements:

var nofactor = require("nofactor");
nostr = nofactor.custom(nofactor.string);
// fix toString for BR tags 
nostr.registerElement("br", nofactor.string.Element.extend({
    toString: function () {
        return "<br />"
var element = nostr.createElement("div");
console.log(element.toString()); // <div><br /></div>