Skip to content

Commit 4060876

Browse files
committed
fix(event): Compatible with Firefox 53 and earlier.
close vuejs#2937
1 parent f67d280 commit 4060876

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,15 @@ let _getNow: () => number = Date.now
1919
// timestamp can either be hi-res (relative to page load) or low-res
2020
// (relative to UNIX epoch), so in order to compare time we have to use the
2121
// same timestamp type when saving the flush timestamp.
22+
23+
// #2937, in firefox 53 and earlier versions, the timestamp is microseconds
24+
// of the current time, resulting in the binding event not being triggered
2225
if (
2326
typeof document !== 'undefined' &&
24-
_getNow() > document.createEvent('Event').timeStamp
27+
(_getNow() > document.createEvent('Event').timeStamp ||
28+
_getNow().toString.length -
29+
(document.createEvent('Event').timeStamp / 1000).toString.length >=
30+
0)
2531
) {
2632
// if the low-res timestamp which is bigger than the event timestamp
2733
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,

0 commit comments

Comments
 (0)