Fixing incompatible markup pointers
Update! See here for a better explanation and solution.
This one's for Google.
If you're working with a TextRange in Internet Explorer, and you try to paste an HTML snippet into the range, you might get this exception: htmlfile: Incompatible markup pointers for this operation. The error occurs when there is an input field with selected text in the browser window, and you try to paste the HTML snippet into a separate TextRange (not the one in the input field). The workaround is to deselect the input field. Since field.blur() never seems to work for me, here's a bit of JavaScript code that does the trick:
function killFocus(refElement)
{
var input = refElement.ownerDocument.createElement("input");
input.type = "text";
refElement.parentNode.appendChild(input);
input.focus();
input.parentNode.removeChild(input);
}
For the curious, I ran into this error while working out conflicts between the Find+Replace bar and the custom Content Editable code. Integration of the custom caret is coming along quite nicely indeed.
- Developer Blog
- › Fixing incompatible markup pointers