Skip to content

event.timeStamp - Firefox #1124

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

Open
HawaiianHope-org opened this issue Feb 4, 2019 · 8 comments
Open

event.timeStamp - Firefox #1124

HawaiianHope-org opened this issue Feb 4, 2019 · 8 comments

Comments

@HawaiianHope-org
Copy link

HawaiianHope-org commented Feb 4, 2019

This is regarding https://api.jquery.com/event.timeStamp/
According to the note : "Note: Due to a bug open since 2004, "
I just tested it and it is still not working as described (for Firefox)

I contacted mozilla and asked them if they could finally fix this.
https://bugzilla.mozilla.org/show_bug.cgi?id=238041#c37

The response i got back was "This bug is not about the current Event.timeStamp" Sounds like they are saying "it is working as designed"
So, is the jQuery code incorrect ? or the documentation incorrect ? or is the response incorrect and it is the bug ? It would be nice for this to work. If the Firefox response is incorrect, can you contact them and point out what the exact problem is, as i have not looked at the source code to know what specifically is the problem,
Thank you !
Oh and if it is correct and the documentation is not, then i already tried reporting that here :
jquery/jquery.org#138

@mgol
Copy link
Member

mgol commented Feb 4, 2019

Thanks for the report. However, I'm not sure how to proceed here. If you're not getting the correct values, please report an issue to the jQuery project at https://github.com/jquery/jquery/issues with a test case using jQuery on JS Bin. Then, we'll be able to see what's the reason and maybe report an issue to Firefox.

Without a bug report with a test case I don't think there's much we can do.

@HawaiianHope-org
Copy link
Author

HawaiianHope-org commented Feb 4, 2019

Sorry, I posted it where you told me to post it in the previous response. Should i kill this and move it ?
And it is easy to show it does not work. Open firefox and go to https://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_event_timestamp
The results in Android or Internet explorer are completely different.

@mgol
Copy link
Member

mgol commented Feb 4, 2019

I guess we can continue here for now until we settle up whether there's a jQuery issue or a docs one.

I see similar behavior in Chrome, Firefox, Safari & Edge. Only IE shows time from January 1, 1970.

According to the spec:

Returns the event’s timestamp as the number of milliseconds measured relative to the time origin.

The time origin link redirects to another spec that says:

  • If the global object is a Window object, the time origin MUST be equal to:
    • the time when the browsing context is first created if there is no previous document;

which suggests our docs are incorrect as we document the legacy IE behavior.

We should update the documentation then.

@mgol
Copy link
Member

mgol commented Feb 4, 2019

MDN also documents it in this way: https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp

This value is the number of milliseconds elapsed from the beginning of the current document's lifetime till the event was created.

@HawaiianHope-org
Copy link
Author

Just FYI, I tested it on my android device, and it showed the time from 1970.
I have not tested it on an apple iPhone or tablet. none of our staff have them.

@mgol
Copy link
Member

mgol commented Feb 4, 2019 via email

@mgol
Copy link
Member

mgol commented Feb 4, 2019

Here's info about when it changed in Chrome: https://googlechrome.github.io/samples/event-timestamp/

Since the standard have changed, we should perhaps just update the docs. We might try normalizing it for IE, though I'm not sure how easy that would be as we'd need a way to find the page load time.

Perhaps it's best to just update the docs that it's no longer time from 1970 but from the current document timeline.

@dmethvin
Copy link
Member

dmethvin commented Feb 5, 2019

The critical thing about event.timeStamp is that it should represent the time at which the original event occurred. In the meantime it might have been queued, for example if there was some other blocking JavaScript running. There is no way we can fill in the value accurately because by the time the event is delivered to jQuery some unknown amount of time has passed. If someone just wants to know the time their event handler saw the event they can save the current time in the jQuery handler.

We should probably just update the docs to say that event.timeStamp is whatever the current browser says it is. See also https://bugs.jquery.com/ticket/10755 .

@Krinkle Krinkle changed the title event.timeStamp - FireFox event.timeStamp - Firefox Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants