From fee7e064842e4bc35a189977c6d8b70d05ec2bb2 Mon Sep 17 00:00:00 2001 From: genify Date: Fri, 28 Sep 2018 15:35:41 +0800 Subject: [PATCH] fix safari12 without "." for performance.now() --- CHANGELOG | 3 ++- src/util/animation/animation.js | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2acca8ae..db0c36d2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,8 @@ 0.5.1 -------------------------------------------------------- - BUG修复模块 - * 修正 util/ajax/rest 无法发送 null 的问题 + * 修正 util/ajax/rest 无法发送 null 数据的问题 + * 修正 util/animation/animation 在 safari12 中当前时间异常 bug 0.5.0 (2018-06-22) -------------------------------------------------------- diff --git a/src/util/animation/animation.js b/src/util/animation/animation.js index 3cd62ff5..4fc4a9f4 100644 --- a/src/util/animation/animation.js +++ b/src/util/animation/animation.js @@ -125,9 +125,14 @@ NEJ.define([ */ _pro.__onAnimationFrame = function(_time){ if (!this.__begin) return; - if ((''+_time).indexOf('.')>=0){ + // fix safari12 without "." for performance.now() + var ts = ''+Math.floor(_time); + if (ts.length<13){ _time = +new Date; } + // if ((''+_time).indexOf('.')>=0){ + // _time = +new Date; + // } if (this.__doAnimationFrame(_time)){ this._$stop(); return;