On Jul 8, 7:03 pm, "Brandon Aaron" <
brandon.aa...@gmail.com> wrote:
> Just created a new branch called "offset_enhancements" to play around with
> some ideas I've got.
>
> I just looked over the APE source ... WOW ... 20k uncompressed just for the
> position file ... our offset file is 6k uncompressed. As usual I'm sure we
> can find a nice balance of performance/size.
>
Comments and long variable names help keep complicated code less
confusing.
The comments alone are probably about 30% of the file size. Then
there's variables like:
IS_STATIC_BODY_OFFSET_PARENT_BUT_ABSOLUTE_CHILD_SUBTRACTS_BODY_BORDER_WIDTH
When minified, the file size changes drastically
position-f-min.js 3.6 kb
position-f.js 20.2 kb
(actual size, before gzip)
It will fail in Safari 2.0.4 in many cases. Safari 2 had an
implementation of offsetTop that was buggy in its own way, but in some
ways more closely matched that of MSIE, at some point, Safari changed
to a behavior much more in line with the CSSOM Views. CSSOM Views
defines an offsetTop that is (or was) different from what MSIE does
(MSIE8 seems to have changed). Safari 3 is closer to CSSOM Views (but
not exactly). The browser market has now about 8 different versions of
"offsetTop". All of the browsers are considerably different. This
advent makes finding an element's position (particularly cross
browser) extremely difficult.
I posted an idea for a new "displacedTop" property on the www-style
list. The idea was to not put any browser in an unfair position, not
break any existing sites, and have a clear definition of what the
property will return. The idea got some positive acknowledgment, but
didn't make way into any spec.
As for the for(;;) loop syntax, yes, it is perfectly valid and works
in all browsers except Mac IE 5 (IIRC).
> --
> Brandon Aaron
>
> On Tue, Jul 8, 2008 at 8:29 PM, Brandon Aaron <
brandon.aa...@gmail.com>
>