     ignoreNavigation = false
     return null
 
-
-
+  # Module return
   {
     create: createTree
     update: updateTree

    holder = []
    holder.unshift top
    window.bodything = body
    tally = 0
    helper.depthFirstWalk body, (depth) ->
      node = this
      if not node.getAttribute?
        return false
      id = node.getAttribute('id')
      if not id
        node.setAttribute('id', tinymce.DOM.uniqueId('t_'))
        id = node.getAttribute('id')
      while depth < (holder.length - 1)
        holder.shift()
      title = node.getAttribute('data-xmlel') || ("[" + node.localName + "]")
      holder[0]['children'] ||= []
      holder[0]['state'] ||= 'closed'
      holder[0]['children'].push {
        'data': title,
        'attr': {
          name: id,
          class: node.getAttribute('class')
        }
      }
      tally += 1
      if (depth) <= holder.length - 1
        holder.unshift holder[0]['children'][holder[0]['children'].length - 1]
    $(selector).jstree({
      json_data: {
        data: [window.topcontainer]

      plugins: ['json_data', 'ui', 'themeroller', 'contextmenu']
      })

  _selectNodeHandlerGenerator = (editor) ->
    selectNodeHandler = (event, data) ->
      if ignoreNavigation
        return
      console.log "select_node", event, data
      node = data.rslt.obj;
      id = node.attr('name');
      if (id)
        console.log "clicked", id

        node = editor.dom.select('#'+id);
        #node.append('<span class="empty_tag_remove_me"></span>');

        nodeEl = node[0]
        editor.getWin().scrollTo(0, editor.dom.getPos(nodeEl).y);
        editor.selection.select(nodeEl)
        editor.nodeChanged()

        editor.focus()

  _depthWalkCallbackGenerator = (holder) ->
    depthWalkCallback = (depth) ->
      node = this
      if not node.getAttribute?
        return false
      id = node.getAttribute('id')
      if not id
        node.setAttribute('id', tinymce.DOM.uniqueId('t_'))
        id = node.getAttribute('id')
      while depth < (holder.length - 1)
        holder.shift()
      title = node.getAttribute('data-xmlel') || ("[" + node.localName + "]")
      holder[0]['children'] ||= []
      holder[0]['state'] ||= 'closed'
      holder[0]['children'].push {
        'data': title,
        'attr': {
          name: id,
          class: node.getAttribute('class')
        }
      }
      if (depth) <= holder.length - 1
        holder.unshift holder[0]['children'][holder[0]['children'].length - 1]
      true


  updateTree = (selector, editor) ->
    body = editor.dom.getRoot()
    $(selector).jstree('delete_node', '#root');
