mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 14:43:28 +00:00
dom: add ParentNode-children.html wpt test
This commit is contained in:
27
tests/wpt/dom/nodes/ParentNode-children.html
Normal file
27
tests/wpt/dom/nodes/ParentNode-children.html
Normal file
@@ -0,0 +1,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>
|
||||
Reference in New Issue
Block a user