title: Correctly parse empty html tags using beautiful soup
body: <p>HTML has a concept of empty elements, as listed on <a href="https://developer.mozilla.org/en-US/docs/Glossary/empty_element" rel="nofollow noreferrer">MDN</a>. However, beautiful soup doesn't seem to handle them properly:</p>
  
  <pre><code>import bs4
  
  soup = bs4.BeautifulSoup(
      '&lt;div&gt;&lt;input name=the-input&gt;&lt;label for=the-input&gt;My label&lt;/label&gt;&lt;/div&gt;',
      'html.parser'
  )
  print(soup.contents)
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>[&lt;div&gt;&lt;input name="the-input"&gt;&lt;label for="the-input"&gt;My label&lt;/label&gt;&lt;/input&gt;&lt;/div&gt;]
  </code></pre>
  
  <p>I.e. the input has wrapped the label.</p>
  
  <p><strong>Question:</strong> Is there any way to get beautiful soup to parse this properly? Or is there an official explanation of this behaviour somewhere I haven't found yet?</p>
  
  <p>At the very least I'd expect something like:</p>
  
  <pre><code>[&lt;div&gt;&lt;input name="the-input"&gt;&lt;/input&gt;&lt;label for="the-input"&gt;My label&lt;/label&gt;&lt;/div&gt;]
  </code></pre>
  
  <p>I.e. the input automatically closed before the label.</p>