New issue
Advanced search Search tips

Issue 692405 link

Starred by 3 users

Issue metadata

Status: Duplicate
Merged: issue 795910
Owner: ----
Closed: Jan 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

<input>.labels is empty if type changes from text->hidden->checkbox

Project Member Reported by zcorpan@gmail.com, Feb 15 2017

Issue description

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

Status: Available (was: Untriaged)

Comment 2 Deleted

Comment 3 by tkent@chromium.org, Jan 9 2018

Mergedinto: 795910
Status: Duplicate (was: Available)

Sign in to add a comment