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