Skip to content


Add workaround for broken splitText() in IE9 #11

timdown opened this Issue · 2 comments

2 participants


Here's a Stack Overflow question illustrating the problem:

I cam across this problem independently. Here's my workaround:

function insertAfter(node, precedingNode) {
var nextNode = precedingNode.nextSibling, parent = precedingNode.parentNode;
if (nextNode) {
parent.insertBefore(node, nextNode);
} else {
return node;

// Note that we cannot use splitText() because it is bugridden in IE 9.
function splitDataNode(node, index) {
var newNode = node.cloneNode(false);
newNode.deleteData(0, index);
node.deleteData(index, node.length - index);
insertAfter(newNode, node);
return newNode;


@timdown If you want to be fixed at some kind of decent time period then adding a unit test that breaks will speed me up ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.