[jQuery] Re: end(), this bug unknown

2007-08-23 Thread John Resig
> I am writing some code using end() method and really, I don't see the > time where > ".onclick() might return a statement that /requires/ a .end() to exist" > > Some example?? Right, that's because it doesn't exist :-) Only the following code is guaranteed to work: $("div.section") .find("dt

[jQuery] Re: end(), this bug unknown

2007-08-23 Thread SeViR
John Resig escribió: Yep, sure thing. I personally like to include the extra .end() (especially when I'm writing long indented statements like that) just so that I can be sure that I have my closing ends. I just think of it as like a closing brace - always good to have, breeds good practices. (

[jQuery] Re: end(), this bug unknown

2007-08-23 Thread Nicolas Hoizey
> In the slide number 50 there is a little example code: > > $("div.section") >.find("dt") > .addClass("section") > .onclick() > .next().toogle().end() > .end() >.end() >.find("dd") > .hide() > .filter(":first") > .show() > .end() >

[jQuery] Re: end(), this bug unknown

2007-08-23 Thread John Resig
Yep, sure thing. I personally like to include the extra .end() (especially when I'm writing long indented statements like that) just so that I can be sure that I have my closing ends. I just think of it as like a closing brace - always good to have, breeds good practices. (Especially for the time

[jQuery] Re: end(), this bug unknown

2007-08-23 Thread Wizzud
Very minor point, but since you only need to end() where you want to restore, and subsequently do something with, the original set of elements, the following is also valid... $("div.section") .find("dt") .addClass("section") .click(function(){ $(this).next().toggle();

[jQuery] Re: end(), this bug unknown

2007-08-23 Thread John Resig
;-) No problem. I love .end(). Although, it should be noted that this snippet: .onclick() .next().toggle().end() .end() does not work - .onclick() doesn't exist (yet). That's something else that I'm working on so that you won't need to write all those annoying function(){ ..