var s = window.getSelection();
if (s.rangeCount > 0)
s.removeAllRanges();
- s.addRange(savedRange);
+ range = document.createRange();
+ range.startContainer = savedsc;
+ range.startOffset = savedso;
+ range.collapse(true);
+ s.addRange(range);
}
else
if (document.createRange)//non IE and no selection
element.parentNode.removeChild(element);
}
-var savedRange;
+var savedsc;
+var savedso;
function getCursorPos() {
var cursorPos;
if (window.getSelection) {
var selObj = window.getSelection();
savedRange = selObj.getRangeAt(0);
+ savedsc = savedRange.startContainer;
+ savedso = savedRange.startOffset;
//cursorPos = findNode(selObj.anchorNode.parentNode.childNodes, selObj.anchorNode) + selObj.anchorOffset;
cursorPos = findNode(unlocked.childNodes, selObj.anchorNode,0) + selObj.anchorOffset;
/* FIXME the following works wrong in Opera when the document is longer than 32767 chars */