> jQuery('a')
> .cond(
> x === 1, function(){
> this.css({ color: 'blue' });
> },
> x === 2, function(){
> this.css({ color: 'red' });
> },
> test, function( val ){
> this.css({ color: val });
> },
> function(){
> this.css({ color: 'green' });
> }
> ).length;
Uhm, At the risk of exposing my complete failure to get the big
ongoing joke here (started by DBJDBJ),
...how is this `.cond()` thing supposed to be more readable/useful/
jQuery-ish than plain old:
jQuery('a').each(function(){
if (x === 1) {
$(this).css({ color: 'blue' });
}
else if (x === 2) {
$(this).css({ color: 'red' });
}
else if (test()) {
$(this).css({ color: val });
}
else {
$(this).css({ color: 'green' });
}
});
or an even more succinct:
jQuery('a').each(function(){
x === 1 ?
$(this).css({ color: 'blue' }):
x === 2 ?
$(this).css({ color: 'red' }):
test() ?
$(this).css({ color: val }):
$(this).css({ color: 'green' });
});
pray tell?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" 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/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---