title: Hide Empty Optgroups
body: <p>I have some dynamically created select menus, and sometimes there were some optgroups without any options inside.</p>
  
  <p>I hid them with a line of CSS code. It worked in Chrome at the time (2016), but revisiting the website I noticed it's no longer working.</p>
  
  <pre><code>optgroup:empty{display:none}
  </code></pre>
  
  <p>Is there a way I can tell if it was deprecated? How should I go about hiding optgroup labels if they do not have any options inside?</p>