Hi,

> I like the idea of endAll(), but it won't help plugin developers:
> 
> 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;
> };

I just had the idea of savepoints:

jQuery.fn.savepoint = function() {
        if( ! this.savePoints )
                this.savePoints = [];
        this.savepoints.push(this.stack.length);
        return this;
}
jQuery.fn.savepointReturn = function() {
        if( ! this.savepoints || this.savepoints.length == 0 )
                return this;
        return this.get(this.stack[this.savepoints.pop()]);
}

then you can do:

jQuery.fn.plugin = function() {
  this.savepoint();
  // do other stuff
  return this.savepointReturn();
};

Christof

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to