]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-dom): compatibility for cases where event.timeStamp is 0 (#1328)
authorAneryu <cyz169@gmail.com>
Fri, 12 Jun 2020 15:00:37 +0000 (23:00 +0800)
committerGitHub <noreply@github.com>
Fri, 12 Jun 2020 15:00:37 +0000 (11:00 -0400)
close #1325

packages/runtime-dom/src/modules/events.ts

index 57f33b6d1f93b916692a44de88f2a26fb2bf164c..f146a3f8f6ed9da76dfe29fa3443aec432efcb15 100644 (file)
@@ -128,7 +128,8 @@ function createInvoker(
     // the solution is simple: we save the timestamp when a handler is attached,
     // and the handler would only fire if the event passed to it was fired
     // AFTER it was attached.
-    if (e.timeStamp >= invoker.lastUpdated - 1) {
+    const timeStamp = e.timeStamp || _getNow()
+    if (timeStamp >= invoker.lastUpdated - 1) {
       callWithAsyncErrorHandling(
         patchStopImmediatePropagation(e, invoker.value),
         instance,