> As an aside, or perhaps a branch, to this conversation...
> I'm a jQuery newbie, and have found it interesting that
> callbacks in the system do not seem to get parameters.
> In systems that I've used before that provided callbacks,
> those callbacks typically got a parameter or set of
> parameters that would allow them to affect the data
> being operated on.
You can pass as much data as you need using a closure, so there's no need to
have a parameter passed in:
var mydata = 0;
$("p").each(function(){
if ( ++mydata > 4 ) this.style.fontWeight = "bold";
});
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, October 04, 2006 11:59 AM
To: jQuery Discussion.
Subject: Re: [jQuery] Chainable if/else - hot or not?
As an aside, or perhaps a branch, to this conversation... I'm a jQuery
newbie, and have found it interesting that callbacks in the system do not
seem to get parameters. In systems that I've used before that provided
callbacks, those callbacks typically got a parameter or set of parameters
that would allow them to affect the data being operated on.
Is this a philosophical matter (callbacks should not modify the current
operation?) or is there something I'm missing?
Thanks!
--Steve
[EMAIL PROTECTED] | irc: monkinetic|redmonk
> I don't know, I've been using .filter( "foo", Function ) and .find(
> "foo", Function ) for a while now and I find them to be immensely
> useful - especially considering that they're non-destructive. IMO,
> having the functions be destructive in the first place was something
> of a mistake, but not really something that can be easily fixed at
> this point. At least having this callback can provide some sanity for
> those who want it ;-)
>
> --John
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/