> Why wouldn't you just use $$(".someClass")
As Arnar said, the performance isn't the same (in fact, I've pretty
much avoided $$ altogether because of bad CSS selector performance
experiences in the past; maybe I should give it another try
though ...).
> I think using aliases is nice, but your particular pattern of using MochiKit
> may not be the same as others
Indeed; the whole point of my post was to find out whether or not it
was; so far it sounds like I'm the only one who minds typing
getElementsByTagAndClassName (unless that changes, I completely agree
that these aliases belong in my local copy, not the framework).
But, as the saying goes, "you'll never know if you don't ask."
Jeremy
On Aug 19, 10:40 am, "Arnar Birgisson" <[EMAIL PROTECTED]> wrote:
> Hey all,
>
> On Tue, Aug 19, 2008 at 17:26, Jason Bunting <[EMAIL PROTECTED]> wrote:
> > I think using aliases is nice, but your particular pattern of using MochiKit
> > may not be the same as others, so I don't see a reason to change things. I
> > rarely use the functions you mention, so their longs names are no problem
> > for me.
>
> I tend to agree. Even so, adding various aliases and shortcuts (i.e.
> partial applications) to MochiKit only makes things complicated and
> clutters the documentation. Functions like partial are there for a
> reason, one of them being that it is super-easy for programmers to set
> up their own aliases.
>
> As for using $$('.classname'), getElementsByTagAndClassName will
> probably give you better performance as the former "compiles" down to
> a traverse of the DOM and applying "hasElementClass". For a long time
> I've wanted to optimize the Selector module, adding caching of
> expressions (to save on "compilation") and special handling of common
> patterns such as just looking for class or id. Sadly, I lack the time
> to invest in it and currently it won't do myself any good. :(
> Furthermore, I suspect there will be support for CSS selectors in
> Javascript in near-future browsers.
>
> cheers,
> Arnar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---