about summary refs log tree commit diff stats
path: root/test/js/collection.html
diff options
context:
space:
mode:
Diffstat (limited to 'test/js/collection.html')
-rw-r--r--test/js/collection.html26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/js/collection.html b/test/js/collection.html
new file mode 100644
index 00000000..4f83875f
--- /dev/null
+++ b/test/js/collection.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<title>HTMLCollection test</title>
+<div id=x>Fail</div>
+<script src=asserts.js></script>
+<form id=test>
+<input id=1 name=input>
+<input id=0 name=input>
+</form>
+<script>
+const x = document.getElementById("x");
+const test = document.getElementById("test");
+assert_equals(document.forms[0], test);
+assert_equals(document.forms["test"], test);
+const elements = test.elements;
+assert_equals(elements["a"], undefined);
+assert_instanceof(elements[0], HTMLInputElement);
+assert_equals(elements[0].id, "1");
+assert_equals(elements["0"].id, "1");
+assert_equals(elements[0].name, "input");
+assert_instanceof(elements["input"], RadioNodeList);
+let el = elements[0];
+el.remove();
+el.remove();
+elements[0].remove();
+x.textContent = "Success";
+</script>