From 06eb066260ac2322ee59621c16d1b5e05fa5836b Mon Sep 17 00:00:00 2001 From: Nic Jansma Date: Fri, 17 Mar 2017 05:10:43 -0400 Subject: [PATCH] Fix performance.now() polyfill (#763) --- packages/velocity/velocity.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/velocity/velocity.js b/packages/velocity/velocity.js index 956236b1..38d8a1c0 100644 --- a/packages/velocity/velocity.js +++ b/packages/velocity/velocity.js @@ -498,8 +498,8 @@ var performance = (function() { var perf = window.performance || {}; - if (!Object.prototype.hasOwnProperty.call(perf, "now")) { - var nowOffset = perf.timing && perf.timing.domComplete ? perf.timing.domComplete : (new Date()).getTime(); + if (typeof perf.now !== "function") { + var nowOffset = perf.timing && perf.timing.navigationStart ? perf.timing.navigationStart : (new Date()).getTime(); perf.now = function() { return (new Date()).getTime() - nowOffset;