diff options
author | Corey Frang <gnarf@gnarf.net> | 2011-09-28 12:00:21 -0400 |
---|---|---|
committer | timmywil <timmywillisn@gmail.com> | 2011-09-28 12:00:21 -0400 |
commit | 8dda57f82f1c366f10c591da099f8e9495eaa01b (patch) | |
tree | 77f71f1c02b9414c022c44e33109a2a203f52a7f /src/effects.js | |
parent | a3b59d7f92c9e15af1888fc4e87639a290763a50 (diff) | |
download | jquery-8dda57f82f1c366f10c591da099f8e9495eaa01b.tar.gz jquery-8dda57f82f1c366f10c591da099f8e9495eaa01b.zip |
Landing pull request 520. Unset the complete function just before calling it to avoid an exception creating a loop. Fixes #5684.
More Details:
- https://github.com/jquery/jquery/pull/520
- http://bugs.jquery.com/ticket/5684
Diffstat (limited to 'src/effects.js')
-rw-r--r-- | src/effects.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/effects.js b/src/effects.js index ee535e3cd..e14235bc4 100644 --- a/src/effects.js +++ b/src/effects.js @@ -481,11 +481,11 @@ jQuery.fx.prototype = { // Each step of an animation step: function( gotoEnd ) { - var t = fxNow || createFxNow(), + var p, n, complete, + t = fxNow || createFxNow(), done = true, elem = this.elem, - options = this.options, - p, n; + options = this.options; if ( gotoEnd || t >= options.duration + this.startTime ) { this.now = this.end; @@ -525,7 +525,15 @@ jQuery.fx.prototype = { } // Execute the complete function - options.complete.call( elem ); + // in the event that the complete function throws an exception + // we must ensure it won't be called twice. #5684 + + complete = options.complete; + if ( complete ) { + + options.complete = false; + complete.call( elem ); + } } return false; |