veAllRanges(sel); range.deleteContents(); try { range = this._createRange(); } catch (ex) { this._removeAllRanges(sel); return false; } switch (node.nodeType) { case 3: if (pos > 0) node = node.splitText(pos); while (toBeInserted.firstChild) { node.parentNode.insertBefore(toBeInserted.firstChild, node); } range.setStart(node, 0); range.setEnd(node, 0); break; case 1: case 11: try { this._removeAllRanges(sel); if (node.childNodes.length >= pos + 1) { node = node.childNodes.item(pos); while (toBeInserted.firstChild) { node.parentNode.insertBefore(toBeInserted.firstChild, node); } var tempText = this._doc.createTextNode(""); node.parentNode.insertBefore(tempText, node); node = tempText; } else { var tempText = this._doc.createTextNode(""); if (Sys.Extended.UI.HTMLEditor.canHaveChildren(node)) { while (toBeInserted.firstChild) { node.appendChild(toBeInserted.firstChild); } node.appendChild(tempText); } else { while (toBeInserted.firstChild) { node.parentNode.insertBefore(toBeInserted.firstChild, node); } node.parentNode.insertBefore(tempText, node); } node = tempText; } if (node.nodeType == 1) { var par = node.parentNode; var container = par; var j = 0; for (; j < par.childNodes.length; j++) { if (node == par.childNodes.item(j)) { break; } } range.setStart(par, j); range.setEnd(par, j); } else { range.setStart(node, 0); range.setEnd(node, 0); }