<head>
    <style>
        ::selection { background-color: red; }
    </style>
    <script src="resources/repaint.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" charset="utf-8">
    function repaintTest()
    {
        sel.empty();
    }
    </script>
</head>
<body onload="runRepaintTest()">
<div style="height: 100px; overflow-y: scroll;">
    <div style="margin-top: 50px;"><div id="target" style="display: inline-block; width: 100px; height: 100px;"></div><br></div>&nbsp;
</div>
<script>
    var sel = getSelection();
    var target = document.getElementById("target");

    sel.setBaseAndExtent(target, 0, target.parentElement.nextSibling, 0);
    document.body.offsetTop;
    target.parentElement.parentElement.scrollTop = 50;
</script>
