Determining when an element is scrollable in Gecko
16 October, 2013 § 1 Comment
As a web developer, there are often times where it’s necessary to know if an element on a page is scrollable. One way of checking this would be to find the difference of
element.clientWidth. If the difference between these two properties is non-zero, then the element is scrollable. However, this doesn’t work for all cases.
element.clientWidth clamp their values to integers. If the difference between the
clientWidth is less than zero, then the computed difference between the two will result in zero. This is less than good.
Starting in Firefox 16 , there is a new property
element.scrollLeftMax which returns the difference of
clientWidth, including the fractional component. Also introduced is the companion
element.scrollTopMax for use in determining vertical scrolling availability.
Hopefully these properties will find their way in to the other layout engines.
 These properties were implemented in bug 766937.