ded/bonzo — pull request #36 by rvagg (2011-10-13 00:27:53+00:00)
Title: offsets() measures size of hidden elements

Looking for some feedback here as this changes the existing API a tad and perhaps there's a better approach.

`offsets()` gets the size of the element but of course you'll get 0's for hidden elements which is not helpful if you're wanting to do something like a *slide down* or other *grow* type of animation on the element that needs to know the final height and/or width, there is also no other way to get that info with Bonzo. The generally accepted solution is to display=block it, measure it then restore it to its original state. But the question is where should this go?

I've put it in `offsets()` for now because there isn't a better place for it but perhaps there should be a new method introduced just for this purpose? You'll see in the diff that I even had to change an unrelated test to make it work because the test was using `.offsets().width == 0` to check for visibility and of course this is broken now cause you'll get width and height for an non-visible element. I suppose this kind of usage will be in the wild already.

I'm thinking perhaps a `dim()` or `dimensions()` method to return height & width. Or perhaps a `layout()` that can be expanded (later) to add all of the goodies you find in Prototype's element.layout(): http://api.prototypejs.org/dom/Element/Layout/ - top, left, bottom, right, padding\*, margin\*, border\*, most of which has to be done lazily to avoid overhead.