2009/1/16 Sébastien Gruhier <sgruh...@gmail.com>: > checkout layout branch > > git checkout -b layout origin/layout > Seb > ----------------------------------------------------------------------- > http://xilinus.com Web Application Development, Consulting, Training > http://mapeed.com Markers fusion plugin for your online maps > Thank you. > > > On Jan 16, 2009, at 11:23 AM, Richard Quadling wrote: > > 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: > > http://github.com/sstephenson/prototype/tree/layout > > http://github.com/sstephenson/prototype/blob/9d28f04d98307f652a2d85ff35e869f2e0ac7f38/src/dom/layout.js > > 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 > > cached. > > (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 > > Element.Layout.) > > 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. > > Cheers, > > Andrew > > > > 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. > > -- > ----- > Richard Quadling > Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 > "Standing on the shoulders of some very clever giants!" > > > > > > > >
-- ----- Richard Quadling 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 prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---