       return                    # nothing to do
 
     # if they have two styles that differ
-    for key, val of @style
-      if not selection.style.hasOwnProperty(key)
+    keys = _.keys(@style)
+    for key in keys
+      if not(_.has(selection.style, key))
         return
-    for key, val of selection.style
-      if not @style.hasOwnProperty(key)
-        return
+    selection.setStyle @style
+
+    selToRemove = @
+    selToKeep = selection
 
     if @atLeftOf selection # remove @
-      selToRemove = @
-      selToKeep = selection
       left = @left
       leftPos = @leftPos
       right = selection.right
       rightPos = selection.rightPos
     else if selection.atLeftOf @ # remove selection
-      selToRemove = selection
-      selToKeep = @
       left = selection.left
       leftPos = selection.leftPos
       right = @right
       rightPos = selection.rightPos
     else if @.in selection # remove @
-      selToRemove = @
-      selToKeep = selection
       left = selection.left
       leftPos = selection.leftPos
       right = selection.right
       rightPos = selection.rightPos
     else if @equals selection # remove @
-      selToRemove = @
-      selToKeep = selection
       left = selection.left
       leftPos = selection.leftPos
       right = selection.right
       rightPos = selection.rightPos
     else if selection.in @ # remove selection
-      selToRemove = selection
-      selToKeep = @
       left = @left
       leftPos = @leftPos
       right = @right

      @right = @rte.getWord retEnd.word
      @rightPos = retEnd.pos

      @left.left.push @
      @right.right.push @

      @rte._rte.selections.push @


    else throw new Error "Wrong set of parameters

        array.splice index, 1
        break

  garbageCollect: ->
    sels = @_rte.selections
    for index in [0..sels.length-1]
      for key, value of sels[index]
        if value == null or value == ""
          sels[index].unbind()
          @removeSel sels[index]
