       
   getAttributeIntersection: ->
     attributes = null
-    console.log 'leaf', this.getLeafNodes()
-    _.all(this.getLeafNodes(), (node) ->
-      leafAttributes = []
-      while node.className != 'line'
-        switch node.tagName
-          when 'B' then leafAttributes['bold'] = true
-          when 'I' then leafAttributes['italic'] = true
-          when 'S' then leafAttributes['strike'] = true
-          when 'U' then leafAttributes['underline'] = true
-        node = node.parentNode
+    _.all(this.getLeafPositions(), (position) ->
+      leafAttributes = position.getAttributes()
       if attributes
         _.each(attributes, (value, key) ->
           if leafAttributes[key] != true

    if range.collapsed
      return [@start.node]
    else
      return _.map(range.getNodes([3]), (node) -> return node.parentNode)

  groupNodesByLine: ->
    currentAncestor = 0
    arr = _.reduce(this.getLeafNodes(), (memo, node) ->
      ancestor = node.parentNode
      while ancestor.className != "line"
        ancestor = ancestor.parentNode
      if currentAncestor == ancestor
        memo[memo.length - 1].push(node)
      else
        memo.push([node])
        currentAncestor = ancestor
      return memo
    , [])
    return arr

  split: (position, before = true) ->
    newNode = @editor.iframeDoc.createElement(position.node.tagName)

        )
      else
        attributes = leafAttributes
      for key,value of attributes when value == true
        return true
      return false
    )

    return attributes || {}
