On Mon, 2012-01-30 at 10:15 +0000, lkcl luke wrote:
> On Mon, Jan 30, 2012 at 10:03 AM, Kees Bos <[email protected]> wrote:
> > On Mon, 2012-01-30 at 09:41 +0000, lkcl luke wrote:
> >> we kinda threw stuff in to see what worked.  at one point, the use of
> >> x['abcd'] instead of x.abcd was added - this unfortunately has a
> >> rather large performance hit on IE's trident engine, so at some point
> >> should go back perhaps to x.$abcd.
> >
> > The use of x['abcd'] needs less attribute mapping that x.abcd (esp. in
> > IE if I remember correctly). I think it was also introduced before we
> > implemented the attribute mapping. And there's a second thing (I think):
> > the google code compressor doesn't mess with strings, but does shorten
> > attribute names.
> >
> > But the major problem with x.$abcd (note the $) is:
> >
> > DOM.py:
> > ...
> > def getOffsetHeight(elem):
> >    return elem.offsetHeight
> > ...
> >
> > this (c/w)ould be translated to:
> > function $getOffsetHeight($elem) {
> >    return $elem.$offsetHeight;
> > }
> >
> > and the problem is $offsetHeight.
> 
>  mrrhhmmm... good point.  that would get compressed, which would
> mangle the whole thing.

Yep, but that's not my major point :-)

offsetHeight is a dom element attribute and must be addressed as
$elem.offsetHeight and not as $elem.$offsetHeight. So, in this case the
translation from py x.foo to x.$foo would be erroneous. Could be catched
with something like (typeof $x.foo == 'undefined'? $x.$foo : $x.foo)
 

Reply via email to