       for n, v of o
         childDom.setAttribute n, v
 
-    insertNode childDom, dom, trailer
+    @$tubularHtmlCursor childDom
 
     if subTemplate
-      @fork { currentDom: childDom, currentTrailer: null }, subTemplate
+      @fork { $tubularHtmlCursor: createState(childDom) }, subTemplate
 
   attr: (setting) ->
     for n, path of setting


# @todo obviously encapsulate
insertNode = (node, dom, trailer) ->
  if trailer
    dom.insertBefore(node, trailer)
  else
    dom.appendChild(node)


window.tubularHtml =
  element: (options...) ->
    # @todo get the container from somewhere (have an "origin" function that seeds view-model state)
    # @todo store HTML-specific view-model state as an object in a single '$tubularHtml' property or something
    dom = if @currentDom then @currentDom else document.getElementById('container')
    trailer = @currentTrailer

    subTemplate = null

    elementName = null


        '' # strip suffix from original name

    childDom = @$tubularHtmlCursor().ownerDocument.createElement(elementName or 'div')

    if elementId isnt null # still trigger for empty ID string
      childDom.setAttribute 'id', elementId
