I have the following JQuery snippet:
(someVar.next().length == 0)?someVar.fadeOut().end().find("ul").first().fadeIn():someVar.fadeOut().next().fadeIn();
There is a fair amount of code duplication between the two results of the conditional - i.e. someVar.fadeOut() and .fadeIn() on both.
I would ideally like something like this:
someVar.fadeOut().((someVar.next().length == 0)?end().find("ul").first():next()).fadeIn();
But that doesn't work :) Safari developer tools reports a syntax error but I'm not skilled enough to work out how to do it properly.
If it can't be shortened, then just saying that is fine :)