Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<html lang="en">
<title>HTMLSelectListElement Test: labels</title>
<link rel="author" title="Ionel Popescu" href="mailto:iopopesc@microsoft.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<label id="label1" for="selectlist1">Label 1</label>
<selectlist id="selectlist1">
<option>one</option>
<option>two</option>
<option>three</option>
<option>four</option>
</selectlist>
<label id="label2" for="selectlist1">Label 2</label>
<label id="label3" for="invalid-selectlist1">Label 3</label>
<script>
test(() => {
let selectList = document.getElementById("selectlist1");
assert_true(selectList.labels instanceof NodeList);
assert_equals(selectList.labels.length, 2);
assert_equals(selectList.labels[0], document.getElementById("label1"));
assert_equals(selectList.labels[1], document.getElementById("label2"));
}, "Validate selectlist.labels");
</script>