]> source.dussan.org Git - jquery.git/commitdiff
shorten requestAnimationFrame test
authorlouisremi <louisremi@louisremi-laptop.(none)>
Fri, 11 Mar 2011 10:33:15 +0000 (11:33 +0100)
committertimmywil <tim.willison@thisismedium.com>
Mon, 4 Apr 2011 19:47:19 +0000 (15:47 -0400)
src/support.js

index 725575b3bcb13638c42c22fa22f6e69938f2ba1d..64a54b83218ba96cb9a8a3d8e8d4d85b41375d79 100644 (file)
@@ -13,7 +13,8 @@
                a = div.getElementsByTagName("a")[0],
                select = document.createElement("select"),
                opt = select.appendChild( document.createElement("option") ),
-               input = div.getElementsByTagName("input")[0];
+               input = div.getElementsByTagName("input")[0],
+               raf = "RequestAnimationFrame";
 
        // Can't get basic test support
        if ( !all || !all.length || !a ) {
 
                // Verify requestAnimationFrame mechanism existence
                // use the prefixed name as the value
-               requestAnimationFrame: window.mozRequestAnimationFrame ?
-                       'mozRequestAnimationFrame' :
-                       window.webkitRequestAnimationFrame ?
-                               'webkitRequestAnimationFrame' :
-                               false,
+               requestAnimationFrame:
+                       window['moz' + raf] ? 'moz' + raf :
+                       window['webkit' + raf] ? 'webkit' + raf :
+                       false,
 
                // Will be defined later
                deleteExpando: true,