       
   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


    [@node, @offset] = TandemPosition.adjustOffset(@node, @offset)
    @text = @node.textContent   # For testing convenience
    
  getIndex: ->
    return @index if @index?

    return @index

  getLine: ->
    ancestors = this.getAncestorNodes()
    return ancestors[ancestors.length - 1]


class TandemRange
