I agree with you, just wanted to through some ideas into the mix, but do you agree that this is "unelegant code"
$('#foo').fadeOut('normal',function(){ $(this).remove(); }); Do you have any suggestions to improve it? I think the last option I provided is the most realistic and I think that making it clear that you may only apply a single jquery method without arguments is within reason. It is just a shortcut, and you can use a whole function wrapper if you want to do something else. On Oct 3, 1:34 pm, "Ariel Flesler" <[EMAIL PROTECTED]> wrote: > Don't like any of those 2. > > The first one is extremmely counter intuitive. While it's "logical" that you > don't want to remove an element right after a fadeOut. You can assume that > any method called after a fadeOut should be delayed. > > Same for second. The second could be a method of the dom element, or the > jqueryfied object. Also, what if you want arguments ? you pass them as > additional arguments to fadeOut ? hmmm... > > On Fri, Oct 3, 2008 at 2:28 PM, mike.helgeson <[EMAIL PROTECTED]>wrote: > > > > > > > I think that maybe this pattern could be improved, but would perhaps > > be counter-intuitive... > > > $('#foo').fadeOut('normal',function(){ $(this).remove(); }); > > > I would rather write... > > > $('#foo').fadeOut().remove(); > > > But perhaps would be happy with... > > > $('#foo').fadeOut('normal','remove'); > > > -mike > > > On Sep 26, 1:59 pm, "John Resig" <[EMAIL PROTECTED]> wrote: > > > I'm curious: Are there any pieces of code that use jQuery, right now, > > > that you feel are unelegant or ugly? (Presumably ones that've already > > > been optimized to the best of their ability.) > > > > One area of improvement that I was thinking of was something along the > > lines of: > > > > // ugly > > > $("#foo").val( $("#bar").val() ); > > > > // a bit better > > > $("#foo").val( $("#bar") ); > > > > this would be an easy change, just make .attr() do something like: > > > > if ( arg.jquery ) > > > val = arg.val() || arg.text() || ""; > > > > Any other thoughts? I wonder if there are common cases that could be > > > improved with some simple code additions to core. > > > > --John > > -- > Ariel Fleslerhttp://flesler.blogspot.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---