Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Commit

Permalink
Fix #152: Make Event's timeStamp use DOMHighResTimeStamp
Browse files Browse the repository at this point in the history
This also closes #154.
  • Loading branch information
zqzhang authored and Yongsheng Zhu committed Dec 4, 2017
1 parent f08095f commit 5fee45e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ urlPrefix: https://w3c.github.io/ServiceWorker/; spec: ServiceWorker
text: script resource; url: #dfn-script-source; type: dfn
url: http://software.hixie.ch/utilities/js/live-dom-viewer
text: Live DOM Viewer; type: dfn
urlPrefix: https://w3c.github.io/hr-time/#; spec: HR-TIME
text: DOMHighResTimeStamp; urlPrefix: dom-; type: typedef
text: time origin; type: dfn
</pre>

<style>
Expand Down
12 changes: 8 additions & 4 deletions sections/events.include
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ interface Event {
readonly attribute boolean defaultPrevented;

[Unforgeable] readonly attribute boolean isTrusted;
readonly attribute DOMTimeStamp timeStamp;
readonly attribute DOMHighResTimeStamp timeStamp;

void initEvent(DOMString type, optional boolean bubbles, optional boolean cancelable);
};
Expand Down Expand Up @@ -141,7 +141,7 @@ inherits from the <code><a>Event</a></code> interface.</p>
:: <p>Returns true if <var>event</var> was <a>dispatched</a> by the user agent, and false otherwise.

: <var>event</var> . {{Event/timeStamp}}
:: <p>Returns the creation time of <var>event</var> as the number of milliseconds that passed since 00:00:00 UTC on 1 January 1970.
:: <p>Returns the <var>event</var>'s timestamp as the number of milliseconds that measured relative to the <a>time origin</a>.

</dl>

Expand Down Expand Up @@ -209,8 +209,7 @@ initialized to false.
(as opposed to using <code><a>dispatchEvent()</a></code>). The sole legacy exception is {{HTMLElement/click()}}, which causes
the user agent to dispatch an <a>event</a> whose {{Event/isTrusted}} attribute is initialized to false.

<p>The <dfn attribute for=Event lt="dom event timeStamp|event timeStamp|timeStamp"><code>timeStamp</code></dfn> attribute's getter must return the value it was initialized to. When an <a>event</a> is created the attribute must be initialized to the number of milliseconds that have passed since 00:00:00 UTC on 1 January 1970, ignoring leap seconds.
<!-- leap seconds are ignored by JavaScript too -->
<p>The <dfn attribute for=Event><code>timeStamp</code></dfn> attribute must return the value it was initialized to.

<hr>

Expand Down Expand Up @@ -296,6 +295,8 @@ method, when invoked, must run these steps:

<li><p> Initialize the {{Event/type}} attribute to the <var>type</var> argument.

<li><p> Initialize <var>event</var>'s {{Event/timeStamp}} attribute to a {{DOMHighResTimeStamp}} representing the high resolution time from the <a>time origin</a> to the occurrence of the call to the <var>event</var>'s <a>constructor</a>.

<li><p> If there is an <var>eventInitDict</var> argument then for each <a>dictionary member</a> present, find the attribute on <a>event</a> whose <a>identifier</a> matches the key of the <a>dictionary member</a> and then set the attribute to the value of that <a>dictionary member</a>.

<li><p> Return the <a>event</a>.
Expand Down Expand Up @@ -323,6 +324,9 @@ it, and optionally given a <a>Realm</a> <var>realm</var>, run these steps:</p>
<a>dictionary member</a> and then set the attribute to the default value of that
<a>dictionary member</a>.

<li><p>Set <var>event</var>'s {{Event/timeStamp}} attribute to a {{DOMHighResTimeStamp}}
representing the high resolution time from the <a>time origin</a> to the occurrence that the event is signaling.

<li><p>Initialize <var>event</var>'s {{Event/isTrusted}} attribute to true.

<li><p>Return <var>event</var>.
Expand Down
2 changes: 2 additions & 0 deletions sections/nodes.include
Original file line number Diff line number Diff line change
Expand Up @@ -2186,6 +2186,8 @@ method, when invoked, must run these steps:

<li><p>Initialize <var>event</var>'s {{Event/type}} attribute to the empty string.

<li><p>Initialize <var>event</var>'s {{Event/timeStamp}} attribute to a {{DOMHighResTimeStamp}} representing the high resolution time from the <a>time origin</a> to now.

<li><p>Initialize <var>event</var>'s {{Event/isTrusted}} attribute to false.

<li><p>Unset <var>event</var>'s <a>initialized flag</a>.
Expand Down

0 comments on commit 5fee45e

Please sign in to comment.