> @ Jacky <[EMAIL PROTECTED]> : > > After some find(), filter(), parent(), siblings()..., > > is there any convenient way to end().... back to the original $("xxx")?
A tested implementation for endAll(): jQuery.fn.endAll = function() { return this.stack ? this.get( this.stack[0] ) : this; }; > > I do it this way: > > $.fn.plugin = function() { > this.find().filter().parent().siblings(); > return this; > } That would return the modified jQuery object. > > This would be good for plugins to return the original jQuery object. I like the idea of endAll(), but it won't help plugin developers: When a plugin wants to return "this" unmodified, it must return the stack as it was. endAll() would modify "this" if a filter or similar method was applied before the plugin. To savely restore the state, you could do something like this (untested): jQuery.fn.plugin = function() { var oldStack = $.merge( [], this.stack ); // do other stuff this.stack = oldStack; return this; }; By merging the current stack into an empty array, a copy of the current stack is created, which can then be used to restore the stack. -- Jörn -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/