old_contents: var t = require('templayed')
  
  module.exports = function (parent, template, id) { 
    var domNode
  
    return function (data, cb) {
      var div = document.createElement('div')
  
      if (data instanceof Function) {
        div.innerHTML = template
        cb = data
      } else div.innerHTML = t(template)(data)
  
      if (domNode) {
        var newNode = div.removeChild(div.firstChild)
        parent.replaceChild(newNode, domNode)
        domNode = newNode
      }
  
      if (!domNode) {
        domNode = div.removeChild(div.firstChild)
        parent.appendChild(domNode)
      }
  
      if (id) domNode.id = id
  
      if (cb) cb(domNode)
    }
  }
  
new_contents: var t = require('templayed')
  
  module.exports = function (parent, template, id) { 
    var domNode
  
    return {
      draw : function (data, cb) {
        var div = document.createElement('div')
  
        if (data instanceof Function) {
          div.innerHTML = template
          cb = data
        } else div.innerHTML = t(template)(data)
  
        if (domNode) {
          var newNode = div.removeChild(div.firstChild)
          parent.replaceChild(newNode, domNode)
          domNode = newNode
        }
  
        if (!domNode) {
          domNode = div.removeChild(div.firstChild)
          parent.appendChild(domNode)
        }
  
        domNode.erase = function () {
          parent.removeChild(domNode)
        }
  
        if (id) domNode.id = id
  
        if (cb) cb(domNode)
      },
      erase : function () {
        parent.removeChild(domNode)
      }
    }
  }
  
subject: add draw/erase methods to mini renderer