2 <script src=../editing.js
></script>
4 function escapeHTML(text
)
6 return text
.replace(/&/g, "&").replace(/</g
, "<");
11 // Select "one" and "two".
12 for (i
= 0; i
< 2; i
++)
13 extendSelectionForwardByLineCommand();
16 // Paste with the cursor right before "four" (insert between three and four)
17 for (i
= 0; i
< 2; i
++)
18 moveSelectionForwardByLineCommand();
21 // Verify that the cursor is in the right place (still before four).
22 var selection
= window
.getSelection();
23 if (selection
.baseNode
.parentNode
.parentNode
.parentNode
!= document
.getElementById("four") ||
24 selection
.baseOffset
!= 0 || !selection
.isCollapsed
)
25 throw "Wrong selection position on before paste.";
27 // Make sure the styles were preserved in the copy by updating the list items.
28 var items
= document
.getElementsByTagName("li");
29 for (var i
= 0; i
< items
.length
; ++i
) {
31 li
.innerHTML
+= ": " + escapeHTML(li
.innerHTML
);
34 document
.getElementById("results").innerText
= "PASS";
39 <div contentEditable=
"true">
40 <p>Copy/pasting list items in a list. This test should be run with DRT for pasteboard access.
</p>
41 <p id=
"results">FAIL
</p>
44 <li><span style=
"background-color: green">two
</span></li>
46 <li id=
"four"><span style=
"background-color: orange"><i>four
</i></span></li>
47 <li>i love counting, counting to the number four
</li>
52 if (window
.testRunner
)
53 testRunner
.dumpAsText();
55 var elem
= document
.getElementById("test");
56 var selection
= window
.getSelection();
57 selection
.collapse(elem
, 0);