         else
           throw new Error('Node not in this container')
 
+      refresh: () ->
+        @_sort()
+        @_rebuildElement()
+          
       element: () ->
         @_element ||= @_buildElement()
 

        formerType = @type
        @type = @tree.resolveType(struct)
        @attributes = struct.attributes
        @container.sort()
        @_rebuildElement(formerType)
        this


          tree.compareNodes(a, b)
        for node in @nodes
          node.container = this
        @_sort()

      empty: () -> @nodes.length == 0

      add: (node) ->
        @nodes.push(node)
        node.container = this
        @refresh()

      remove: (node) ->
        if node in @nodes
