Something I’m pretty happy with out of my loot.js project is the $dom function. I saw this post on Hacker News by Neil Jenkins about a dom constructor $el funciton that used a css selector to define the tag class and id, an object to define other properties on that tag and an array for the children. I thought this was awesome and started using it but wanted to eliminate the function calls for each node and also wanted to be able to store a complex dom structure and later use it with the function. This lead me down the path of something much like hiccup, although I didn’t learn about hiccup until after I had nearly finished $dom it seems to be very similar. One final requirement I had was that I wanted to be able to produce dom structures AND output htmlText in node.js without using jsdom, I will explain how this works later in the post.