|
430 | 430 | }
|
431 | 431 |
|
432 | 432 | if (typeof callback === 'function') callback.apply(self);
|
433 |
| - |
434 |
| - // Defer execution of next call. It may trigger another CSS transition, |
435 |
| - // in which case Opera can screw up when it's executed in the same |
436 |
| - // JavaScript 'tick'. |
437 |
| - if (typeof nextCall === 'function') window.setTimeout(nextCall, 0); |
| 433 | + if (typeof nextCall === 'function') nextCall(); |
438 | 434 | };
|
439 | 435 |
|
440 |
| - // Use the 'transitionend' event if it's available, then fallback to timers. |
441 | 436 | if ((i > 0) && (transitionEnd)) {
|
| 437 | + // Use the 'transitionend' event if it's available. |
442 | 438 | bound = true;
|
443 | 439 | self.bind(transitionEnd, cb);
|
444 | 440 | } else {
|
445 |
| - // Durations that are too slow will get transitions mixed up. (Tested |
446 |
| - // on Mac/FF 7.0.1) |
447 |
| - if ((support.transition === 'MozTransition') && (i < 25)) i = 25; |
| 441 | + // Fallback to timers if the 'transitionend' event isn't supported. |
448 | 442 | window.setTimeout(cb, i);
|
449 | 443 | }
|
450 | 444 | };
|
451 | 445 |
|
| 446 | + // Defer running. This allows the browser to paint any pending CSS it hasn't |
| 447 | + // painted yet before doing the transitions. |
| 448 | + var deferredRun = function(next) { |
| 449 | + var i = 0; |
| 450 | + |
| 451 | + // Durations that are too slow will get transitions mixed up. |
| 452 | + // (Tested on Mac/FF 7.0.1) |
| 453 | + if ((support.transition === 'MozTransition') && (i < 25)) i = 25; |
| 454 | + |
| 455 | + window.setTimeout(function() { run(next); }, i); |
| 456 | + }; |
| 457 | + |
452 | 458 | // Use jQuery's fx queue.
|
453 | 459 | if (typeof queue === 'string')
|
454 |
| - self.queue(queue, run); |
| 460 | + self.queue(queue, deferredRun); |
455 | 461 | else if (queue)
|
456 |
| - self.queue(run); |
| 462 | + self.queue(deferredRun); |
457 | 463 | else
|
458 |
| - run(); |
| 464 | + deferredRun(); |
459 | 465 |
|
460 | 466 | // Chainability.
|
461 | 467 | return this;
|
|
0 commit comments