3 <title>Test for Bug
1713334</title>
4 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
5 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
6 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css">
8 <textarea id=
"textarea"></textarea>
12 function assertChild(div
, content
) {
13 const name
= div
.parentElement
.localName
;
14 is(div
.firstChild
.nodeType
, Node
.TEXT_NODE
, `<${name}>: The first node of the root element must be a text node`);
15 is(div
.firstChild
.textContent
, content
, `<${name}>: The content of the text node is wrong`);
18 function test(element
) {
21 const { rootElement
} = SpecialPowers
.wrap(element
).editor
;
22 assertChild(rootElement
, "");
25 assertChild(rootElement
, "");
28 assertChild(rootElement
, "foo");
31 assertChild(rootElement
, "");
33 element
.value
= "foo";
35 SpecialPowers
.wrap(element
).
37 selectionController
.getSelection(
38 SpecialPowers
.Ci
.nsISelectionController
.SELECTION_NORMAL
40 selection
.setBaseAndExtent(rootElement
, 0, rootElement
, 1);
41 document
.execCommand("delete");
42 assertChild(rootElement
, "");
45 SimpleTest
.waitForExplicitFinish();
46 SimpleTest
.waitForFocus(() => {
47 test(document
.all
.input
);
48 test(document
.all
.textarea
);