   anchorNode = sel.anchorNode
   anchorOffset = sel.anchorOffset
   return unless plainObject.contains(anchorNode)
-  cursorLo = cursorLocationFromNodeAndOffset(plainObject, anchorNode, anchorOffset)
-  console.log("CursorLo: #{cursorLo}")
+  cursorLo = cursorLocationForRootNodeFromAnchorNodeAndOffset(plainObject, anchorNode, anchorOffset)
+#  cursorLo = cursorLocationFromNodeAndOffset(plainObject, anchorNode, anchorOffset)
   jObject.data("cursorlocation", cursorLo)
 
 

  formattedText = formattedText.replace(/&nbsp;/g, ' ')           # &nbsp; -> ' '
  return formattedText

cursorLocationFromNodeAndOffset = (rootNode, anchorNode, anchorOffset) ->
  location = 0
  if rootNode == anchorNode
    if rootNode.nodeType == Node.TEXT_NODE
      location += anchorOffset
    else if rootNode.tagName == "SPAN"
      for i in [0..anchorOffset] by 1
        location += cursorLocationFromNodeAndOffset(rootNode.childNodes[i], anchorNode, anchorOffset)
  else
    if rootNode.nodeType == Node.TEXT_NODE
      location += rootNode.nodeValue.length
    else if rootNode.tagName == "BR"
      location += 1
    else
      for childNode in rootNode.childNodes
        if childNode == anchorNode
          location += cursorLocationFromNodeAndOffset(childNode, anchorNode, anchorOffset)
          return location
        else
          location += cursorLocationFromNodeAndOffset(childNode, anchorNode, anchorOffset)
  return location

lengthOfNode = (node) ->
  if node.nodeType == Node.TEXT_NODE

  dataText = dataText.replace(/'/g, '&apos;')   # ' -> &apos;
  dataText = dataText.replace(/\//g, '&#x2F;')  # / -> &#x2F;
  dataText = dataText.replace(/\n/g, '<br>')    # \n -> <br>
  # Coffee cannot compile if use literal '/ /g'
  dataText = dataText.replace(new RegExp(' ', 'g'), '&nbsp;')   # ' ' -> &nbsp;
  return dataText

colorfy = (dataText, descriptor, htmlfier) ->
