From 22790b250cd5239a8379b4ec8cc3a9b570dac4bc Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 19 Mar 2019 12:44:49 +0800 Subject: [PATCH] fix(scheduler): revert timeStamp check fix #9729 This reverts #9667, but also fixes the original issue #9632 by skipping the check in IE altogether (since all IE use low-res event timestamps). --- src/core/observer/scheduler.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/core/observer/scheduler.js b/src/core/observer/scheduler.js index 20170cc0..ed5c504a 100644 --- a/src/core/observer/scheduler.js +++ b/src/core/observer/scheduler.js @@ -8,7 +8,8 @@ import { warn, nextTick, devtools, - inBrowser + inBrowser, + isIE } from '../util/index' export const MAX_UPDATE_COUNT = 100 @@ -47,16 +48,19 @@ let getNow: () => number = Date.now // timestamp can either be hi-res (relative to page load) or low-res // (relative to UNIX epoch), so in order to compare time we have to use the // same timestamp type when saving the flush timestamp. -if (inBrowser) { +// All IE versions use low-res event timestamps, and have problematic clock +// implementations (#9632) +if (inBrowser && !isIE) { const performance = window.performance if ( performance && typeof performance.now === 'function' && - document.createEvent('Event').timeStamp <= performance.now() + getNow() > document.createEvent('Event').timeStamp ) { - // if the event timestamp is bigger than the hi-res timestamp - // (which is evaluated AFTER) it means the event is using a lo-res timestamp, - // and we need to use the lo-res version for event listeners as well. + // if the event timestamp, although evaluated AFTER the Date.now(), is + // smaller than it, it means the event is using a hi-res timestamp, + // and we need to use the hi-res version for event listener timestamps as + // well. getNow = () => performance.now() } }