focusNode.getNodeValue().substring(0, focusOffset));
try {
mutationListener.startTransientMutations();
focusNode.getParentNode().insertBefore(txt, focusNode);
txt.getParentNode().insertAfter(SPAN, txt);
OffsetPosition ret =
new OffsetPosition(SPAN.getOffsetLeft(), SPAN.getOffsetTop(), SPAN.getOffsetParent());
return ret;
} finally {
SPAN.removeFromParent();
txt.removeFromParent();
mutationListener.endTransientMutations();
}
} else {
Element e = focusNode.cast();
return new OffsetPosition(e.getOffsetLeft(), e.getOffsetTop(), e.getOffsetParent());
}
}