summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/nodes/ParentNode-children.html
blob: 6621e7d9def48998609d7cc988b4f8253490f7e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<meta charset=utf-8>
<title>ParentNode.children</title>
<link rel=help href="https://dom.spec.whatwg.org/#dom-parentnode-children">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div style="display: none">
  <ul><li id='test'>1</li><li>2</li><li>3</li><li>4</li></ul>
</div>
<script>
test(() => {
  var node = document.getElementById("test");
  var parentNode = node.parentNode;
  var children = parentNode.children;
  assert_true(children instanceof HTMLCollection);
  var li = document.createElement("li");
  assert_equals(children.length, 4);

  parentNode.appendChild(li);
  assert_equals(children.length, 5);

  parentNode.removeChild(li);
  assert_equals(children.length, 4);
}, "ParentNode.children should be a live collection");
</script>
</html>