title: What is the height of a "line" in a wheel event? (deltaMode = DOM_DELTA_LINE)
body: <p>The <code>wheel</code> event in Firefox >= 17 has a <code>deltaMode</code> property. With the OS/mouse I'm using, it's set to <code>1</code> (or <code>DOM_DELTA_LINE</code>). This setting means that the <code>deltaX</code> and <code>deltaY</code> event values are measured in lines and not pixels. Sure enough, if I pretend the deltas are pixels, scroll speeds are much slower than they normally are in Firefox.</p>
  
  <p>Chrome 31 by contrast uses a <code>deltaMode</code> of <code>0</code> (or <code>DOM_DELTA_PIXEL</code>), which allows me to simulate scrolling with normal speeds.</p>
  
  <p>If I could convert the line values to pixel values, I'd be all set. But I can't find a scrap of documentation about what a "line" is. I tried changing the <code>font-size</code> and <code>line-height</code> in Firefox, which didn't change the scrolling behavior.</p>
  
  <p>Anyone know how a "line" is defined? W3C just says, "This is the case for many form controls."</p>
  
  <p><a href="http://www.w3.org/TR/DOM-Level-3-Events/#widl-WheelEvent-deltaMode">W3C <code>deltaMode</code></a></p>
  
  <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent">MDN <code>WheelEvent</code></a></p>
  
  <p><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/wheel">MDN <code>wheel</code></a></p>
  
  <p><strong>Edit:</strong> here's <a href="http://jsfiddle.net/neonsilk/Zd7yB/1/">a fiddle</a> to demonstrate the oddity. When Firefox is in <code>DOM_DELTA_LINE</code> mode, there's no consistent ratio between pixels and lines – it's all over the place. And when I switch to using a trackpad instead of a mouse, causing Firefox to switch to <code>DOM_DELTA_PIXEL</code> mode, there's also no consistent ratio. On the other hand, in Chrome 31, the ratio is almost always very close to 1:1 in <code>DOM_DELTA_PIXEL</code> mode.</p>
  
  <p><a href="http://code.google.com/p/chromium/issues/detail?id=227454">Chromium issue: implement DOM3 wheel event</a></p>
  
  <p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=719320">Bugzilla bug: implement DOM3 wheel event</a></p>
  
  <p><strong>Update:</strong> Scrolling by single ticks of a mouse wheel in Firefox where <code>deltaMode</code> is <code>DOM_DELTA_LINE</code>, the pixel delta is dependent on the CSS <code>font-size</code>, but not on <code>line-height</code>. See <a href="http://jsfiddle.net/neonsilk/Zd7yB/4/">this fiddle</a> for a demonstration. This behavior only holds when ticking the wheel very slowly. With speed or momentum, the line to pixel ratio isn't predictable at any particular instance or in aggregate. As far as I can tell, there's no way to emulate Firefox's scroll behavior using the delta measurements provided in <code>DOM_DELTA_LINE</code> mode.</p>
  
  <p>In <code>DOM_DELTA_PIXEL</code> mode, the behavior is nearly pixel-perfect. That is, the ratio between actual pixels scrolled and the reported pixel delta value is almost exactly 1, which is demonstrated in the <a href="http://jsfiddle.net/neonsilk/Zd7yB/4/">the same fiddle</a>.</p>
  
  <p>I <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=943034">filed a bug with Mozilla</a>, arguing that the behavior of the <code>wheel</code> event in <code>DOM_DELTA_LINE</code> mode isn't useful because it isn't predictable (i.e., it's an equation where both the unit and the magnitude are variables). The issue has been marked invalid because the expected behavior is for the <code>wheel</code> event to pass through the native deltas provided by the OS, despite the fact that Firefox itself doesn't honor these deltas.</p>
  
  <p>I'll leave this question open in the hope that <code>DOM_DELTA_LINE</code> will be defined by a spec somewhere. As far as I know, the dependence on <code>font-size</code> (and not <code>line-height</code>) isn't yet described anywhere.</p>