From 1acea73cba707c34f884738d2502e9d2e709583a Mon Sep 17 00:00:00 2001 From: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com> Date: Wed, 16 Aug 2023 23:06:45 -0400 Subject: [PATCH] Add hasUAVisualTransition to popState and navigate events Closes #8782. --- source | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/source b/source index 657afbe5d4d..696823da581 100644 --- a/source +++ b/source @@ -91612,6 +91612,7 @@ interface NavigateEvent : Event { readonly attribute FormData? formData; readonly attribute DOMString? downloadRequest; readonly attribute any info; + readonly attribute boolean hasUAVisualTransition; undefined intercept(optional NavigationInterceptOptions options = {}); undefined scroll(); @@ -91736,6 +91737,11 @@ callback NavigationInterceptHandler = Promise<undefined> navigation, or undefined if the navigation was initiated by the user or by a different API.

+
event.hasUAVisualTransition
+

Returns true if the user agent performed a visual transition for this navigation before + dispatching this event. If true, the best user experience will be given if the author + synchronously updates the DOM to the post-navigation state.

+
event.intercept({ handler, focusReset, scroll })

Intercepts this navigation, preventing its normal handling and instead converting it into a @@ -91839,9 +91845,11 @@ callback NavigationInterceptHandler = Promise<undefined> for="NavigateEvent">signal, formData, downloadRequest, and info attributes must return - the values they are initialized to.

+ data-x="dom-NavigateEvent-downloadRequest">downloadRequest, info, and hasUAVisualTransition attributes + must return the values they are initialized to.

The intercept(options) method steps @@ -92365,6 +92373,11 @@ interface NavigationDestination { tracker.

+
  • Initialize event's hasUAVisualTransition to true if a visual + transition, to display a cached rendered state of the document's latest + entry, was done by the user agent. Otherwise, initialize it to false.

  • +
  • Set event's abort controller to a new AbortController created in navigation's relevant realm.

  • @@ -92878,6 +92891,7 @@ interface PopStateEvent : Event { constructor(DOMString type, optional PopStateEventInit eventInitDict = {}); readonly attribute any state; + readonly attribute boolean hasUAVisualTransition; }; dictionary PopStateEventInit : EventInit { @@ -92890,6 +92904,12 @@ dictionary PopStateEventInit : EventInit {

    Returns a copy of the information that was provided to pushState() or replaceState().

    + +
    event.hasUAVisualTransition
    + +

    Returns true if the user agent performed a visual transition for this navigation before + dispatching this event. If true, the best user experience will be given if the author + synchronously updates the DOM to the post-navigation state.

    @@ -92899,6 +92919,9 @@ dictionary PopStateEventInit : EventInit { initialized to. It represents the context information for the event, or null, if the state represented is the initial state of the Document.

    +

    The + hasUAVisualTransition attribute must return the value it was initialized to.

    +
    @@ -99588,7 +99611,10 @@ location.href = '#foo'; object, using PopStateEvent, with the state attribute initialized to document's history object's state.

    + data-x="concept-history-state">state and hasUAVisualTransition initialized to + true if a visual transition, to display a cached rendered state of the latest + entry, was done by the user agent.

  • Restore persisted state given entry.

  • @@ -139378,6 +139404,7 @@ INSERT INTERFACES HERE Kevin Cole, Kevin Gadd, Kevin Venkiteswaran, + Khushal Sagar, Kinuko Yasuda, Koji Ishii, Kornél Pál,