4 <title>Test for paste in temporarily created div element outside the body element
</title>
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
7 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
9 SimpleTest
.waitForExplicitFinish();
10 SimpleTest
.waitForFocus(async () => {
11 const editor
= document
.querySelector("div[contenteditable]");
12 const heading
= document
.querySelector("h1");
13 getSelection().setBaseAndExtent(heading
.firstChild
, "So".length
,
14 heading
.firstChild
, "Some te".length
);
16 await SimpleTest
.promiseClipboardChange(
17 "me te", () => synthesizeKey("c", {accelKey
: true}));
19 ok(false, `Failed to copy selected text: ${ex}`);
23 editor
.addEventListener("paste", () => {
24 const anotherEditor
= document
.createElement("div");
25 anotherEditor
.setAttribute("contenteditable", "true");
26 document
.documentElement
.appendChild(anotherEditor
);
27 anotherEditor
.focus();
29 synthesizeKey("v", {accelKey
: true});
30 const tempEditor
= document
.documentElement
.lastChild
;
31 is(tempEditor
.nodeName
.toLocaleLowerCase(), "div",
32 "Paste event handler should've inserted another editor");
33 is(tempEditor
.textContent
.trim(), "me te");
40 <div contenteditable
></div>