Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getTime issue #11634

Closed
thisboyiscrazy opened this issue Sep 2, 2020 · 2 comments
Closed

getTime issue #11634

thisboyiscrazy opened this issue Sep 2, 2020 · 2 comments

Comments

@thisboyiscrazy
Copy link

Version

2.6.12

Reproduction link

https://jsfiddle.net/chrisvfritz/50wL7mdz/

Steps to reproduce

Run in on a browser without hi-res timers.

Minimal reproduction does not work because I can not test on my browser or at least I do not know how to turn off Hi Res timers in chrome.

What is expected?

Events to propogate. e.g. an outter div will fire v-on:click for child elements.

What is actually happening?

It's not


in file vue.runtime.esm.js:

change lines 4259 to 4281 to fix:

// Async edge case fix requires storing an event listener's attach timestamp.
var getNow = Date.now;
var baseNow = Date.now();

// Determine what event timestamp the browser is using. Annoyingly, the
// 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.
// All IE versions use low-res event timestamps, and have problematic clock
// implementations (#9632)
if (inBrowser && !isIE) {
var performance = window.performance;
if (
performance &&
typeof performance.now === 'function' &&
getNow() > document.createEvent('Event').timeStamp
) {
// 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 = function () { return performance.now(); };
} else {
getNow = function () { return Date.now() - baseNow; };
}
}

@posva
Copy link
Member

posva commented Sep 2, 2020

It's impossible to know without a code sample but please check existing issues with browser quirk tag: browser quirks

Maybe these are relevant #10515 #10366

Check if any of the PR fix the behavior you are seeing, if not you might want to leave a comment with your solution there

@posva posva closed this as completed Sep 2, 2020
@thisboyiscrazy
Copy link
Author

thisboyiscrazy commented Sep 2, 2020

Here is a code sample:

https://jsfiddle.net/285paowq/3/

Click "Toggle" 3 times so that it attaches and reattaches the component. Then clicking "Text 1" should update ts. But it does not because the event does not propagate to the parent.

Note the problem only shows up in browsers that the if statement in vue.runtime.esm.js line 4271 evals to false.

I first noticed the propagation problem in vue.runtime.esm.js line 6910.

That lead me to the fix on I stated.

The solution was in the notes at the bottom of the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants