For those less knowledgable about JS, can you please explain what you
mean by partial() and bind()?
Thank you,
Eric
--- Aaron Boodman <[EMAIL PROTECTED]> wrote:
> Jeez, I can't type today. That should have been:
>
> for (var i = 0; i < 5; i++) {
> partial(handleClick, i);
> }
>
> or, you can do it inline with an anon function like:
>
> partial(function(arg) {
> // do stuff w/ arg
> }, i);
>
> I think the main argument against this is that it can cause memory
> leaks. This is a fair complaint. I prefer to take the chance and
> later
> debug the leaks, since I greatly prefer this form and since the leaks
> are mozilla bugs that should hopefully someday go away.
>
> But like I said, I'm interested in counter arguments.
>
> - a
>
> On 5/30/06, Aaron Boodman <[EMAIL PROTECTED]> wrote:
> > On 5/30/06, Nickolay Ponomarev <[EMAIL PROTECTED]> wrote:
> > > - but you're better off not using this unless you understand how
> it
> > > works. (And it's really unnecessary if all you need to pass is a
> > > simple string).
> >
> > eh... I prefer this form. I think tacking attributes onto random
> > elements to store state is, err, tacky and has more chance to
> collide
> > with other people's random additions. Also, with bind() it is
> really
> > quite elegant:
> >
> > for (var i = 0; i < 5; i++) {
> > button.addEventListener("click", bind(i); i++);
> > }
> >
> > Finally, I've read that attributes are quite expensive in mozilla,
> > since they can be tied to CSS, XBL, etc.
> >
> > Why do you think it's better to store something in the DOM rather
> than
> > in pure JS?
> >
> > - a
> >
> _______________________________________________
> Project_owners mailing list
> [email protected]
> http://mozdev.org/mailman/listinfo/project_owners
>
Use Your PC To Find a Cure for
Cancerhttp://members.ud.com/services/teams/team.htm?id=68C9E079-8285-495F-8598-D73352CC7075And
Join Team Lulu
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners