4774354.html 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <script src="../../resources/run-after-layout-and-paint.js" type="text/javascript"></script>
  2. <script type="text/javascript">
  3. function step1() {
  4. if (window.testRunner)
  5. testRunner.waitUntilDone();
  6. // Wait for the frame to load.
  7. window.setTimeout(step2, 100);
  8. }
  9. function step2() {
  10. var frame = frames[0];
  11. var doc = frame.document;
  12. var body = doc.body;
  13. var sel = frame.getSelection();
  14. frame.focus();
  15. sel.collapse(body, 0);
  16. doc.execCommand("InsertText", false, "You should not see a caret in this text.");
  17. var text = body.firstChild;
  18. sel.collapse(text, text.length);
  19. // Wait for the caret to paint.
  20. runAfterLayoutAndPaint(repaintTest);
  21. }
  22. function repaintTest() {
  23. var frame = frames[0];
  24. var doc = frame.document;
  25. var body = doc.body;
  26. var text = body.firstChild;
  27. var sel = frame.getSelection();
  28. sel.setBaseAndExtent(text, 5, text, text.length);
  29. if (window.testRunner)
  30. testRunner.notifyDone();
  31. }
  32. </script>
  33. <body onload="step1();">
  34. <iframe src="resources/contenteditable-iframe-src.html"></iframe>
  35. </body>