     # unbind selection
     selection.unbind()
 
+  garbageCollect: ->
+    sels = @_rte.selections
+    for index in [0..sels.length-1]
+      for key, value of sels[index]
+        console.log sels[index], "has", key, value, "deleting!"
+        if value == null or value == ""
+          sels[index].unbind()
+          @removeSel sels[index]
+
+
 if window?
   window.Rte = Rte
   window.Selection = Selection

        break

  # Get index of word in rte list
  index: (rte) ->
    if not (rte instanceof Rte)
      throw new Error "Expected an RTE instance as first argument, got #{rte}"
    return rte._rte.words.indexOf @


# A class describing a selection with a style (bold, italic, …)

  # @param index [Integer] the index of the word to return
  getWord: (index) ->
    if @_rte.words.length == 0 or index == @_rte.words.length
      return new Word "", @

    if not (0 <= index < @_rte.words.length)
      throw new Error "Index out of bounds #{index}"
