Skip to content

Instantly share code, notes, and snippets.

@pietern
Created May 21, 2009 21:40
Show Gist options
  • Save pietern/115767 to your computer and use it in GitHub Desktop.
Save pietern/115767 to your computer and use it in GitHub Desktop.
Patch for jQuery 1.3.2 that makes animations work correctly when
working with different window contexts in Adobe AIR (1.5).
It causes the interval to be set on the window that belongs to
the element the animation is performed on.
===
@@ -4049,8 +4049,9 @@ jQuery.fx.prototype = {
t.elem = this.elem;
+ window = this.elem.ownerDocument.defaultView;
if ( t() && jQuery.timers.push(t) && !timerId ) {
- timerId = setInterval(function(){
+ timerId = window.setInterval(function(){
var timers = jQuery.timers;
for ( var i = 0; i < timers.length; i++ )
@@ -4058,7 +4059,7 @@ jQuery.fx.prototype = {
timers.splice(i--, 1);
if ( !timers.length ) {
- clearInterval( timerId );
+ window.clearInterval( timerId );
timerId = undefined;
}
}, 13);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment