Skip to content

Commit 8319668

Browse files
committed
Fixing requestAnimationFrame & cancelAnimationFrame
With the previous implementation, Chrome complains: "'webkitCancelAnimationFrame' is vendor-specific. Please use the standard 'cancelAnimationFrame' instead." This fixes that by reusing (copy-paste) the code from angular.js A better way would be to use ionic.requestAnimationFrame and ionic.cancelAnimationFrame everywhere, but that is more involved and risky...
1 parent 55e910d commit 8319668

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

js/utils/dom.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@
2626
};
2727
})();
2828

29-
var vendors = ['webkit', 'moz'];
30-
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
31-
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
32-
window.cancelAnimationFrame =
33-
window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
34-
}
35-
window.cancelAnimationFrame =
36-
window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
29+
var cancelAnimationFrame = window.cancelAnimationFrame ||
30+
window.webkitCancelAnimationFrame ||
31+
window.mozCancelAnimationFrame ||
32+
window.webkitCancelRequestAnimationFrame;
33+
34+
window.requestAnimationFrame = window._rAF;
35+
window.cancelAnimationFrame = cancelAnimationFrame;
3736

3837
/**
3938
* @ngdoc utility

0 commit comments

Comments
 (0)