From 207b8bd3a33db5c8ae70d6182945ef73cc690a14 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Wed, 13 Jan 2021 13:42:58 +0100 Subject: [PATCH] [WIP] Temporal proposal HTML serialization support This patch lets Temporal objects be serialized, both in storage and with postMessage, if they use built-in calendars and timezones. This is the only expected integration of Temporal with HTML/DOM expected initially; see earlier discussion in https://github.com/w3ctag/design-reviews/issues/311 The current draft just includes Temporal.PlainDate, and it will be extended to all of the Temporal types after initial review. This patch should not be landed until (at least) Temporal reaches Stage 3. --- source | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/source b/source index 9e74bdec23d..1e1d960fd22 100644 --- a/source +++ b/source @@ -2876,6 +2876,15 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

User agents that support JavaScript must also implement the Top-Level Await proposal.

+

User agents that support JavaScript must also implement the Temporal + proposal. The following terms are defined in the Temporal proposal and used in this + specification:

+ + + +

User agents that support JavaScript must also implement the Import Assertions proposal. The following terms are defined there, and used in this specification:

@@ -8422,6 +8431,21 @@ interface DOMStringList { +
  • +

    Otherwise, if value has an [[InitializedTemporalDate]] internal slot, then:

    + +
      +
    1. If value.[[Calendar]] does not have a [[InitializedTemporalCalendar]] + internal slot, then throw a "DataCloneError" + DOMException.

    2. + +
    3. Set serialized to { [[Type]]: "Temporal.PlainDate", [[ISOYear]]: + value.[[ISOYear]], [[ISOMonth]]: value.[[ISOMonth]], [[ISODay]]: + value.[[ISODay]], [[Calendar]]: value.[[Calendar]].[[Identifier]] + }.

    4. +
    +
  • +
  • Otherwise, if value is a platform object that is a serializable object:

    @@ -8831,6 +8855,17 @@ o.myself = o;
  • +
  • +

    Otherwise, if serialized.[[Type]] is "Temporal.PlainDate", then:

    + +
      +
    1. Set value to ! Construct(%Temporal.PlainDate%, « + serialized.[[ISOYear]], serialized.[[ISOMonth]], + serialized.[[ISODay]], »).

    2. +
    +
  • +
  • Otherwise:

    @@ -125485,6 +125520,9 @@ INSERT INTERFACES HERE
    [JSTLA]
    Top-Level Await. Ecma International.
    +
    [JSTTEMPORAL]
    +
    Temporal. Ecma International.
    +
    [JSON]
    The JavaScript Object Notation (JSON) Data Interchange Format, T. Bray. IETF.