 
   # Convert "display" text indices to "source" text indices.
   computeSourcePositions: (match) ->
+#    console.log "In computeSourcePosition"
+#    console.log match.element.pathInfo.path
+#    console.log match.element.pathInfo.node.data
+
+    # the HTML source of the text inside a text element.
     sourceText = match.element.pathInfo.node.data.replace /\n/g, " "
-    # the HTML source of the text inside a text element.
-
+#    console.log "sourceText is '" + sourceText + "'"
+
+    # what gets displayed, when the node is processed by the browser.
     displayText = match.element.pathInfo.content
-    # what gets displayed, when the node is processed by the browser.
-
+#    console.log "displayText is '" + displayText + "'"
+
+    # The selected range in displayText.
     displayStart = if match.start? then match.start else 0
     displayEnd = if match.end? then match.end else displayText.length
-    # The selected range in displayText.
+#    console.log "Display range is: " + displayStart + "-" + displayEnd
 
     sourceIndex = 0
     displayIndex = 0

class window.DomTextMapper
  constructor: ->
    @setRealRoot()

  # ===== Public methods =======

  # Consider only the sub-tree beginning with the given node.
  # 

        endOffset: endOffset
        endInfo: endInfo
    }
#    console.log "Done collecting"
    result

  # ===== Private methods (never call from outside the module) =======

  timestamp: -> new Date().getTime()

  domChangedSince: (timestamp) ->
#    console.log "Has the DOM changed since " + timestamp + "?"
    if @lastDOMChange? and timestamp? then @lastDOMChange > timestamp else true
#    if @lastDOMChange? and timestamp?
#      console.log "We have a timestamp, checking..."
#      result = @lastDOMChange > timestamp
#      console.log result
#    else
#      console.log "We don't have a timestamp (or a reference), assuming it has changed."
#      true        

  domStableSince: (timestamp) -> not @domChangedSince timestamp

  getProperNodeName: (node) ->
    nodeName = node.nodeName
