1 <p>This tests that edited whitespaces aren't all nbsps. When the region becomes non-editable, Hello and World should still be on different lines. This demonstrates a bug: the div's focus halo doesn't go away when it becomes non-editable.
</p>
2 <div id=
"div" contenteditable=
"true" style=
"border: 1px solid black; width: 60px;"></div>
6 var li
= document
.createElement("li");
7 li
.appendChild(document
.createTextNode(str
));
8 var console
= document
.getElementById("console");
9 console
.appendChild(li
);
12 if (window
.testRunner
)
13 testRunner
.waitUntilDone();
15 var div
= document
.getElementById("div");
16 var sel
= window
.getSelection();
18 document
.execCommand("InsertText", false, " ");
19 document
.execCommand("InsertText", false, "Hello");
20 document
.execCommand("InsertText", false, " ");
21 document
.execCommand("InsertText", false, " ");
22 document
.execCommand("InsertText", false, " ");
23 document
.execCommand("InsertText", false, " ");
24 document
.execCommand("InsertText", false, " ");
25 document
.execCommand("InsertText", false, "World");
26 document
.execCommand("InsertText", false, " ");
28 var innerText
= div
.innerHTML
;
30 // Check the pattern produced. This might change in the future.
31 var expected
= " Hello World ";
33 for (var i
= 0; i
< innerText
.length
; i
++) {
34 if(innerText
[i
] != expected
[i
])
35 log("Error: Character " + i
+ " of the editable region was not what was expected.");
38 div
.contentEditable
= "false";
39 // When we turn content editability off, we'll see Hello and World on the same line if editing is using all nbsps.
41 // Ensure we push a final frame to avoid flake.
42 if (window
.testRunner
) {
43 window
.requestAnimationFrame(function() {
44 testRunner
.notifyDone();