code: function moveToNodeStart(range, node) {
          if (node.nodeType == 3) {
            var count = 0, cur = node.previousSibling;
            while (cur && cur.nodeType == 3) {
              count += cur.nodeValue.length;
              cur = cur.previousSibling;
            }
            if (cur) {
              try{range.moveToElementText(cur);}
              catch(e){return false;}
              range.collapse(false);
            }
            else range.moveToElementText(node.parentNode);
            if (count) range.move("character", count);
          }
          else {
            try{range.moveToElementText(node);}
            catch(e){return false;}
          }
          return true;
        }
docs: Move the start of a range to the start of a node, compensating for the fact that you can't call moveToElementText with text nodes.