소스 검색

fix(runtime-dom): compatibility for cases where event.timeStamp is 0 (#1328)

close #1325
Aneryu 6 년 전
부모
커밋
90c3532946
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      packages/runtime-dom/src/modules/events.ts

+ 2 - 1
packages/runtime-dom/src/modules/events.ts

@@ -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,