<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>Selection on replaced element</title>
  <style type="text/css">
    img {
      position: relative;
      top: 80px;
    }
    img.moved {
      top: 0px;
    }
  </style>
  <script src="resources/repaint.js" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript" charset="utf-8">
    function loaded()
    {
      var selection = window.getSelection();
      var image = document.getElementById('test');
      const range = new Range;
      range.selectNode(image);
      selection.removeAllRanges();
      selection.addRange(range);
      runRepaintTest();
    }
    function repaintTest()
    {
       document.getElementById('test').className = 'moved';
    }
  </script>
</head>
<body onload="loaded()">
  <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=22472">https://bugs.webkit.org/show_bug.cgi?id=22472</a>
    <i>Selection is not completely erased when a replaced element moves</i>
  </p>
  <img id="test" src="resources/apple.jpg" width="214" height="232" alt="Apple">
</body>
</html>