title: Width of an element accounting for quirks mode in javascript?
body: <p>I've been scanning through all the popular js libraries, but I can't find one that has a width function for a DOM element that actually accounts for quirks mode in Internet Explorer. The issue is that padding and borders don't get counted in the the width when quirks mode is engaged. As far as I can tell this happens when the doctype is left out or the doctype is set to html 3.2.</p>
  
  <p>Obviously I could just set the doctype to something standards compliant, but this script can be embedded anywhere so I don't have control over the doctype.</p>
  
  <p>To break the problem down into smaller parts:</p>
  
  <p>1) How do you detect quirks mode?
  2) What's the best way to extract the border and padding from an element to compensate?</p>
  
  <p>Example with prototype:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div id="mydiv" style="width: 250px; pading-left: 1px; border: 2px black solid"&gt;hello&lt;/div&gt;
  
  &lt;script&gt;
    alert($('mydiv').getWidth())
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>result:</p>
  
  <p>253 (ff)
  250 (ie)</p>
  
  <p>Thanks in advance!</p>