<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - &lt;input&gt;.labels is empty if type changes from text-&gt;hidden-&gt;checkbox"
   href="https://bugs.webkit.org/show_bug.cgi?id=168358">168358</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>&lt;input&gt;.labels is empty if type changes from text-&gt;hidden-&gt;checkbox
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>Safari Technology Preview
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>HTML DOM
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zcorpan&#64;gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>cdumez&#64;apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider

&lt;!doctype html&gt;
&lt;p&gt;&lt;label&gt;&lt;input&gt;&lt;/label&gt;&lt;/p&gt;
&lt;script&gt;
 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';
 // WebKit 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
&lt;/script&gt;


&lt;input&gt;.labels should be live, but after changing type from &quot;text&quot; to &quot;hidden&quot; and then to &quot;checkbox&quot;, labels.length is 0. Expected 1.

web-platform-tests: <a href="https://github.com/w3c/web-platform-tests/pull/4804">https://github.com/w3c/web-platform-tests/pull/4804</a>
HTML Standard: <a href="https://github.com/whatwg/html/pull/2355">https://github.com/whatwg/html/pull/2355</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>