Consider
<!doctype html>
<p><label><input></label></p>
<script>
const input = document.querySelector('input');
const labels = input.labels;
console.assert(labels.length === 1);
input.type = 'hidden';
console.assert(labels.length === 0); // the label is no longer the input's labeled control
console.assert(input.labels === null);
input.type = 'checkbox';
// Chromium fails this assert:
console.assert(labels.length === 1); // the label is once again the input's labeled control
console.assert(input.labels === labels); // same value as returned originally
</script>
<input>.labels should be live, but after changing type from "text" to "hidden" and then to "checkbox", labels.length is 0. Expected 1.
web-platform-tests: https://github.com/w3c/web-platform-tests/pull/4804
HTML Standard: https://github.com/whatwg/html/pull/2355
Comment 1 by tkent@chromium.org
, Feb 17 2017