1 <body contentEditable=
"true">
2 <p>When inserting a new line, we should break out of nested divs.
</p>
4 <div>first
<div>second
</div><div>third
</div></div>
6 <script src=
"../editing.js"></script>
9 window
.testRunner
.dumpAsText();
11 internals
.settings
.setEditingBehavior("mac");
13 document
.getElementById("results").innerText
= "FAIL";
17 // Try inserting a new line after the last div.
18 var div2
= document
.getElementsByTagName("div")[1];
19 var div3
= document
.getElementsByTagName("div")[2];
20 execSetSelectionCommand(div3
, 0, div3
, 0);
21 execMoveSelectionForwardByWordCommand();
23 execTypeCharacterCommand("\n");
24 execInsertHTMLCommand("This should be in a single div.");
26 var div4
= document
.getElementsByTagName("div")[3];
27 if (div4
.innerHTML
!= "This should be in a single div.")
28 fail("wrong div4? " + div4
.innerHTML
);
29 if (div4
.parentNode
.tagName
!= "BODY")
30 fail("div should not be nested: " + div4
.parentNode
.tagName
);
32 // Try inserting a new line after the second div. This should be nested.
33 execSetSelectionCommand(div2
, 0, div2
, 0);
34 execMoveSelectionForwardByWordCommand();
36 execTypeCharacterCommand("\n");
37 execInsertHTMLCommand("This should be in nested divs.");
39 var nestedDiv
= document
.getElementsByTagName("div")[2];
40 if (nestedDiv
.innerHTML
!= "This should be in nested divs.")
41 fail("wrong nestedDiv? " + nestedDiv
.innerHTML
);
42 if (nestedDiv
.parentNode
.tagName
!= "DIV")
43 fail("div should be nested: " + nestedDiv
.parentNode
.tagName
);
45 document
.getElementById("results").innerText
= "SUCCESS";