title: Javascript: Detecting if text would wrap
body: <p>How can I detect if a piece of text would wrap?</p>
  
  <p>So imagine I have a UI with a header that has largish text. I want the biggest text here that fits vertically in a menu bar. It displays numerical data like this:</p>
  
  <pre><code>LABEL: 9999   LABEL2: 99999
  </code></pre>
  
  <p>The number parts can get larger. On some screens - e.g. phones - it causes the element to overflow and wrap below the bar that it is supposed to stay in. I don't want to do overflow:hidden. I want the user to see the whole thing.</p>
  
  <p>I'd like to be able to somehow calculate how big the element would be, and if it would wrap pre-emptively shrink the font, possibly move the element left to make space.</p>