Skip to content

Commit 081ebbb

Browse files
committed
Updated for best rAF prefixing
1 parent a3abafa commit 081ebbb

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

dist/jquery.requestAnimationFrame.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@
44

55
(function( $ ) {
66

7-
var animating,
8-
requestAnimationFrame = window.webkitRequestAnimationFrame ||
9-
window.mozRequestAnimationFrame ||
10-
window.oRequestAnimationFrame;
7+
// FireFox apparently doesn't like using this from a variable...
8+
window.requestAnimationFrame = window.requestAnimationFrame ||
9+
window.webkitRequestAnimationFrame ||
10+
window.mozRequestAnimationFrame ||
11+
window.oRequestAnimationFrame ||
12+
window.msRequestAnimationFrame;
13+
14+
var animating;
1115

1216
function raf() {
1317
if ( animating ) {
14-
requestAnimationFrame( raf );
18+
window.requestAnimationFrame( raf );
1519
jQuery.fx.tick();
1620
}
1721
}
1822

19-
if ( requestAnimationFrame ) {
23+
if ( window.requestAnimationFrame ) {
2024

2125
jQuery.fx.timer = function( timer ) {
2226
if ( timer() && jQuery.timers.push( timer ) && !animating ) {

dist/jquery.requestAnimationFrame.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/jquery.requestAnimationFrame.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,23 @@
99

1010
(function( $ ) {
1111

12-
var animating,
13-
requestAnimationFrame = window.webkitRequestAnimationFrame ||
14-
window.mozRequestAnimationFrame ||
15-
window.oRequestAnimationFrame;
12+
// FireFox apparently doesn't like using this from a variable...
13+
window.requestAnimationFrame = window.requestAnimationFrame ||
14+
window.webkitRequestAnimationFrame ||
15+
window.mozRequestAnimationFrame ||
16+
window.oRequestAnimationFrame ||
17+
window.msRequestAnimationFrame;
18+
19+
var animating;
1620

1721
function raf() {
1822
if ( animating ) {
19-
requestAnimationFrame( raf );
23+
window.requestAnimationFrame( raf );
2024
jQuery.fx.tick();
2125
}
2226
}
2327

24-
if ( requestAnimationFrame ) {
28+
if ( window.requestAnimationFrame ) {
2529

2630
jQuery.fx.timer = function( timer ) {
2731
if ( timer() && jQuery.timers.push( timer ) && !animating ) {

0 commit comments

Comments
 (0)