I’ve come across an interesting bug. The following code works OK in IE8 in order to set focus to an element with contentEditable="true"
in IE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>hello world</title>
<style type="text/css">
</style>
<script type="text/javascript">
window.onload = function() {
var el = document.getElementById('aaa');
el.contentEditable = true;
el.focus(); // fails to focus with caret if el is an anchor
}
</script>
<head>
<body>
<p href="aa.html" id="aaa">sdgsdfsdfss</p>
</body>
</html>
However, if you instead try this with an anchor (just replace the <p> with an <a>) it focuses the anchor (gives it the dotted outline), but doesn’t put the caret in there - you have to click it.
I’d really like someone to test this with the new IE9 please, and let me know if it’s the same.