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

Add a timezonechange event to Window/WorkerGlobalScope #3047

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
40 changes: 40 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2794,6 +2794,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-copydatablockbytes">CopyDataBlockBytes</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-createbytedatablock">CreateByteDataBlock</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-createdataproperty">CreateDataProperty</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-daylight-saving-time-adjustment">DaylightSavingsTA</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.github.io/ecma402/#sec-defaulttimezone">DefaultTimeZone</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-detacharraybuffer">DetachArrayBuffer</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-enumerableownpropertynames">EnumerableOwnPropertyNames</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-finishdynamicimport">FinishDynamicImport</dfn> abstract operation</li>
mathiasbynens marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -15163,6 +15165,7 @@ interface <dfn>HTMLStyleElement</dfn> : <span>HTMLElement</span> {
<dd><code data-x="handler-window-onbeforeunload">onbeforeunload</code></dd>
<dd><code data-x="handler-window-onhashchange">onhashchange</code></dd>
<dd><code data-x="handler-window-onlanguagechange">onlanguagechange</code></dd>
<dd><code data-x="handler-window-ontimezonechange">ontimezonechange</code></dd>
<dd><code data-x="handler-window-onmessage">onmessage</code></dd>
<dd><code data-x="handler-window-onmessageerror">onmessageerror</code></dd>
<dd><code data-x="handler-window-onoffline">onoffline</code></dd>
Expand Down Expand Up @@ -90250,6 +90253,26 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
microtask checkpoint</span> algorithm.</p>


<h5>Time zone changes</h5>

<p>JavaScript programs can observe the current time zone. <code>Date</code> uses the time zone
through the <span>LocalTZA</span> and <span>DaylightSavingsTA</span> algorithms.
mathiasbynens marked this conversation as resolved.
Show resolved Hide resolved
<code>Intl.DateTimeFormat</code> uses the time zone in its <span>DefaultTimeZone</span> algorithm.
mathiasbynens marked this conversation as resolved.
Show resolved Hide resolved
Although it is not explicitly stated in the JavaScript specification, user agents may update the
current time zone over the execution of a page as the user's time zone changes, providing
different results for these algorithms over time.</p>

<p>When a UA has a new time zone to present to JavaScript, as would be observable by any of
those algorithms, the user agent must
<span>queue a task</span> to <span data-x="concept-event-fire">fire an event</span> named <code
data-x="event-timezonechange">timezonechange</code> at the <code>Window</code> or
<code>WorkerGlobalScope</code> object, if no such task is already queued. The new time zone must
be observable by JavaScript at the point the task begins to run, and it must not be observable
earlier.</p>

<p>The <span>task source</span> for this <span data-x="concept-task">task</span> is the
<span>DOM manipulation task source</span>.</p>

<h5>Queuing tasks</h5>

<p>To <dfn data-export="">queue a task</dfn> on a <span>task source</span> <var>source</var>,
Expand Down Expand Up @@ -92052,6 +92075,7 @@ typedef <span>OnBeforeUnloadEventHandlerNonNull</span>? <dfn>OnBeforeUnloadEvent
<tr><td><dfn><code data-x="handler-window-onbeforeunload">onbeforeunload</code></dfn> <td> <code data-x="event-beforeunload">beforeunload</code>
<tr><td><dfn><code data-x="handler-window-onhashchange">onhashchange</code></dfn> <td> <code data-x="event-hashchange">hashchange</code> <!-- new -->
<tr><td><dfn><code data-x="handler-window-onlanguagechange">onlanguagechange</code></dfn> <td> <code data-x="event-languagechange">languagechange</code> <!-- new -->
<tr><td><dfn><code data-x="handler-window-ontimezonechange">ontimezonechange</code></dfn> <td> <code data-x="event-timezonechange">timezonechange</code> <!-- new -->
<tr><td><dfn><code data-x="handler-window-onmessage">onmessage</code></dfn> <td> <code data-x="event-message">message</code> <!-- new for postMessage -->
<tr><td><dfn><code data-x="handler-window-onmessageerror">onmessageerror</code></dfn> <td> <code data-x="event-messageerror">messageerror</code> <!-- new for SAB -->
<tr><td><dfn><code data-x="handler-window-onoffline">onoffline</code></dfn> <td> <code data-x="event-offline">offline</code> <!-- new -->
Expand Down Expand Up @@ -92190,6 +92214,7 @@ interface mixin <dfn>WindowEventHandlers</dfn> {
attribute <span>OnBeforeUnloadEventHandler</span> <span data-x="handler-window-onbeforeunload">onbeforeunload</span>;
attribute <span>EventHandler</span> <span data-x="handler-window-onhashchange">onhashchange</span>;
attribute <span>EventHandler</span> <span data-x="handler-window-onlanguagechange">onlanguagechange</span>;
attribute <span>EventHandler</span> <span data-x="handler-window-ontimezonechange">ontimezonechange</span>;
attribute <span>EventHandler</span> <span data-x="handler-window-onmessage">onmessage</span>;
attribute <span>EventHandler</span> <span data-x="handler-window-onmessageerror">onmessageerror</span>;
attribute <span>EventHandler</span> <span data-x="handler-window-onoffline">onoffline</span>;
Expand Down Expand Up @@ -98721,6 +98746,7 @@ interface <dfn>WorkerGlobalScope</dfn> : <span>EventTarget</span> {

attribute <span>OnErrorEventHandler</span> <span data-x="handler-WorkerGlobalScope-onerror">onerror</span>;
attribute <span>EventHandler</span> <span data-x="handler-WorkerGlobalScope-onlanguagechange">onlanguagechange</span>;
attribute <span>EventHandler</span> <span data-x="handler-WorkerGlobalScope-ontimezonechange">ontimezonechange</span>;
attribute <span>EventHandler</span> <span data-x="handler-WorkerGlobalScope-onoffline">onoffline</span>;
attribute <span>EventHandler</span> <span data-x="handler-WorkerGlobalScope-ononline">ononline</span>;
attribute <span>EventHandler</span> <span data-x="handler-WorkerGlobalScope-onrejectionhandled">onrejectionhandled</span>;
Expand Down Expand Up @@ -98834,6 +98860,7 @@ interface <dfn>WorkerGlobalScope</dfn> : <span>EventTarget</span> {
<tbody>
<tr><td><dfn><code data-x="handler-WorkerGlobalScope-onerror">onerror</code></dfn> <td> <code data-x="event-error">error</code>
<tr><td><dfn><code data-x="handler-WorkerGlobalScope-onlanguagechange">onlanguagechange</code></dfn> <td> <code data-x="event-languagechange">languagechange</code> <!-- new -->
<tr><td><dfn><code data-x="handler-WorkerGlobalScope-ontimezonechange">ontimezonechange</code></dfn> <td> <code data-x="event-timezonechange">timezonechange</code>
<tr><td><dfn><code data-x="handler-WorkerGlobalScope-onoffline">onoffline</code></dfn> <td> <code data-x="event-offline">offline</code> <!-- new -->
<tr><td><dfn><code data-x="handler-WorkerGlobalScope-ononline">ononline</code></dfn> <td> <code data-x="event-online">online</code> <!-- new -->
<tr><td><dfn><code data-x="handler-WorkerGlobalScope-onrejectionhandled">onrejectionhandled</code></dfn> <td> <code data-x="event-rejectionhandled">rejectionhandled</code>
Expand Down Expand Up @@ -117270,6 +117297,7 @@ interface <dfn>External</dfn> {
<code data-x="handler-window-onbeforeunload">onbeforeunload</code>;
<code data-x="handler-window-onhashchange">onhashchange</code>;
<code data-x="handler-window-onlanguagechange">onlanguagechange</code>;
<code data-x="handler-window-ontimezonechange">ontimezonechange</code>;
<code data-x="handler-window-onmessage">onmessage</code>;
<code data-x="handler-window-onmessageerror">onmessageerror</code>;
<code data-x="handler-window-onoffline">onoffline</code>;
Expand Down Expand Up @@ -120374,6 +120402,12 @@ interface <dfn>External</dfn> {
<td> <code data-x="event-languagechange">languagechange</code> event handler for <code>Window</code> object
<td> <span data-x="event handler content attributes">Event handler content attribute</span>

<tr>
<th id="ix-handler-window-ontimezonechange"> <code data-x="">ontimezonechange</code>
<td> <code data-x="handler-window-ontimezonechange">body</code>
<td> <code data-x="event-timezonechange">timezonechange</code> event handler for <code>Window</code> object
<td> <span data-x="event handler content attributes">Event handler content attribute</span>

<tr>
<th id="ix-handler-onload"> <code data-x="">onload</code>
<td> <span data-x="handler-onload">HTML elements</span>
Expand Down Expand Up @@ -121255,6 +121289,12 @@ INSERT INTERFACES HERE
<td> Global scope objects
<td> Fired at the global scope object when the user's preferred languages change

<tr> <!-- timezonechange -->
<td> <dfn data-dfn-type="event" data-dfn-for="Window,WorkerGlobalScope" data-export=""><code data-x="event-timezonechange">timezonechange</code></dfn>
<td> <code>Event</code>
<td> Global scope objects
<td> Fired at the global scope object when the user's current timezone changes

<tr> <!-- load -->
<td> <dfn data-dfn-type="event" data-dfn-for="Window,HTMLElement" data-export=""><code data-x="event-load">load</code></dfn>
<td> <code>Event</code>
Expand Down