5 <title>DOMNode Object actor test
</title>
6 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel=
"stylesheet" type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css">
8 <script type=
"application/javascript" src=
"webconsole-helpers.js"></script>
12 const TEST_URL
= "data:text/html,<html><body>Hello</body></html>";
14 window
.onload
= async
function() {
15 SimpleTest
.waitForExplicitFinish();
18 const commands
= await
addTabAndCreateCommands(TEST_URL
);
19 await
testNotInTreeElementNode(commands
);
20 await
testInTreeElementNode(commands
);
21 await
testNotInTreeTextNode(commands
);
22 await
testInTreeTextNode(commands
);
24 ok(false, `Error thrown: ${e.message}`);
29 async
function testNotInTreeElementNode(commands
) {
30 info("Testing isConnected property on a ElementNode not in the DOM tree");
31 const {result
} = await commands
.scriptCommand
.execute("document.createElement(\"div\")");
32 is(result
.getGrip().preview
.isConnected
, false,
33 "isConnected is false since we only created the element");
36 async
function testInTreeElementNode(commands
) {
37 info("Testing isConnected property on a ElementNode in the DOM tree");
38 const {result
} = await commands
.scriptCommand
.execute("document.body");
39 is(result
.getGrip().preview
.isConnected
, true,
40 "isConnected is true as expected, since the element was retrieved from the DOM tree");
43 async
function testNotInTreeTextNode(commands
) {
44 info("Testing isConnected property on a TextNode not in the DOM tree");
45 const {result
} = await commands
.scriptCommand
.execute("document.createTextNode(\"Hello\")");
46 is(result
.getGrip().preview
.isConnected
, false,
47 "isConnected is false since we only created the element");
50 async
function testInTreeTextNode(commands
) {
51 info("Testing isConnected property on a TextNode in the DOM tree");
52 const {result
} = await commands
.scriptCommand
.execute("document.body.firstChild");
53 is(result
.getGrip().preview
.isConnected
, true,
54 "isConnected is true as expected, since the element was retrieved from the DOM tree");
61 <div id=
"content" style=
"display: none">