3 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
8 var container
= document
.getElementById("container");
9 container
.appendChild(document
.createElement("div"));
14 var container
= document
.getElementById("container");
15 container
.firstChild
.remove();
22 InspectorTest
.eventHandler
["DOM.setChildNodes"] = setChildNodes
;
23 InspectorTest
.eventHandler
["DOM.childNodeCountUpdated"] = childNodeCountUpdated
;
25 InspectorTest
.sendCommand("DOM.getDocument", {}, onGotDocument
);
27 function onGotDocument(msg
)
29 if (InspectorTest
.completeTestIfError(msg
))
31 InspectorTest
.sendCommand("DOM.querySelector", { nodeId
: msg
.result
.root
.nodeId
, selector
: "#container" }, onQuerySelector
);
34 function onQuerySelector(msg
)
36 if (InspectorTest
.completeTestIfError(msg
))
38 containerNodeId
= msg
.result
.nodeId
;
39 InspectorTest
.log("Node arrived with childNodeCount: " + nodeInfo
[containerNodeId
].childNodeCount
);
41 InspectorTest
.sendCommand("Runtime.evaluate", { expression
: "addNode()"});
42 InspectorTest
.sendCommand("Runtime.evaluate", { expression
: "removeNode()"});
43 InspectorTest
.sendCommand("Runtime.evaluate", { expression
: "removeNode()"});
44 InspectorTest
.sendCommand("Runtime.evaluate", { expression
: "removeNode()"},
45 InspectorTest
.completeTest
.bind(InspectorTest
));
48 function setChildNodes(message
)
50 var nodes
= message
.params
.nodes
;
51 for (var i
= 0; i
< nodes
.length
; ++i
) {
52 nodeInfo
[nodes
[i
].nodeId
] = nodes
[i
];
53 delete nodes
[i
].nodeId
;
57 function childNodeCountUpdated(message
)
59 if (message
.params
.nodeId
=== containerNodeId
)
60 InspectorTest
.log("childCountUpdated: " + message
.params
.childNodeCount
);
66 <body onload=
"runTest()">
67 <div id=
"container" style=
"display:none"><div>child1
</div><div>child2
</div></div>