about summary refs log tree commit diff stats
path: root/test/js/collection.html
blob: 4f83875fd0fa04b9aebabb541ab5a77813c725cf (plain) (blame)
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
<!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>