2009/1/16 Andrew Dupont <goo...@andrewdupont.net>:
> I've just committed a couple large API additions in a "layout" branch
> in our Git repository:
> It's still very preliminary, but Element.Layout is meant to like a
> lazy-loading, memoized subclass of Hash. It gives measurements and
> offsets of practically any aspect an element's layout box. It's lazy-
> loading because some of these computations are costly and shouldn't be
> done unless strictly necessary.
> In other words, I can do something like this...
> var foo = $('foo');
> var layout = foo.getLayout();
> var width = layout.get('width'); // 144 (or some other number)
> var marginBoxWidth = layout.get('margin-box-width'); // 164 (content +
> padding + border + margin)
> Behind the scenes, it determined the "width" (i.e., the content box
> width) by taking the offsetWidth property from the element (which is
> the width of the element's "border box") and subtracting the computed
> padding and border widths on both sides. When it did this, it cached
> the values for many other measurements, like "border-box-width,"
> "padding-left," "padding-right," and so on. If any of these values are
> requested directly, no further computation is necessary.
> Furthermore, when we ask for the "margin-box-width" (i.e., the space
> the element truly commands), it knows it needs to fetch "margin-left"
> and "margin-right," but the values of all other properties are already
> (A caveat: because of the caching, an Element.Layout object should be
> treated like a "snapshot" of an element's dimensions. When the
> dimensions of an object change, you ought to grab a new instance of
> Take a look at the code and tell me what you think. The API is far
> from complete, naturally, but it'd be great to know if people think
> this is the right idea.
Assuming I've used ...
git clone git://github.com/sstephenson/prototype.git
why do I not get the layout.js file?
And I've done this in a clean folder.
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to email@example.com
To unsubscribe from this group, send email to
For more options, visit this group at