old_contents: // jsdom doesn't have support for requestAnimationFrame so we just make it work.
  global.requestAnimationFrame = function (func) {
    var args = Array.prototype.slice.call(arguments).slice(1);
    return func.apply(this, args);
  };
  
new_contents: // jsdom doesn't have support for requestAnimationFrame so we polyfill it.
  // https://gist.github.com/paulirish/1579671
  (function() {
    var lastTime = 0;
    var vendors = ['ms', 'moz', 'webkit', 'o'];
  
    for (var x = 0; x < vendors.length && !global.requestAnimationFrame; ++x) {
      global.requestAnimationFrame = global[vendors[x] + 'RequestAnimationFrame'];
      global.cancelAnimationFrame = global[vendors[x] + 'CancelAnimationFrame']
        || global[vendors[x] + 'CancelRequestAnimationFrame'];
    }
  
    if (!global.requestAnimationFrame)
      global.requestAnimationFrame = function (callback, element) {
        var currTime = new Date().getTime();
        var timeToCall = Math.max(0, 16 - (currTime - lastTime));
        var id = global.setTimeout(
          function () {
            callback(currTime + timeToCall);
          },
          timeToCall
        );
  
        lastTime = currTime + timeToCall;
        return id;
      };
  
    if (!global.cancelAnimationFrame) {
      global.cancelAnimationFrame = function(id) {
        clearTimeout(id);
      };
    }
  }());
  
subject: Implement a better requestAnimationFrame polyfill