From 99f4e402e2bcba1fca09e6667b2ab03ff80713c5 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Mon, 14 Nov 2022 21:39:05 +0900 Subject: [PATCH] NavigationDestination section and NavigateEvent domintro --- source | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 93 insertions(+), 7 deletions(-) diff --git a/source b/source index 2c5216ad7fd..392cf626759 100644 --- a/source +++ b/source @@ -87061,7 +87061,7 @@ interface NavigationHistoryEntry : EventTarget

The index of this NavigationHistoryEntry within navigation.entries(), or −1 if the entry is not in the navigation history entry list.

entry.sameDocument
-

Indicates whether or not this navigation history entry is for the same Document as the current one, or not. This will be true, for exampel, when the entry represents a fragment navigation or single-page app navigation.

+

Indicates whether or not this navigation history entry is for the same Document as the current one, or not. This will be true, for example, when the entry represents a fragment navigation or single-page app navigation.

entry.getState()
@@ -88035,6 +88035,48 @@ callback NavigationInterceptHandler = Promise<undefined>

(Notably, this will be null even for "reload" or "traverse" navigations that are revisiting a session history entry that was originally created from a form submission.)

+ +
event.downloadRequest
+
+

Represents whether or not this navigation was requested to be a download, by using an a or area element's download attribute:

+ + + +

Note that a download being requested does not always mean that a download will happen: for example, a download might be blocked by browser security policies, or end up being treated as a "push" navigation for unspecified reasons.

+ +

Similarly, a navigation might end up being a download even if it was not requested to be one, due to the destination server responding with a `Content-Disposition: attachment` header.

+ +

Finally, note that the navigate event will not fire at all for downloads initiated using browser UI affordances, e.g., those created by right-clicking and choosing to save the target of a link.

+
+ +
event.info
+

An arbitrary JavaScript value passed via one of the navigation API methods which initiated this navigation, or undefined if the navigation was initiated by the user or by a different API.

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

Intercepts this navigation, preventing its normal handling and instead converting it into a same-document navigation of the same type to the destination URL.

+ +

The handler option can be a function that returns a promise. The handler function will run after the navigate event has finished firing, and the navigation.currentEntry property has been synchronously updated. This returned promise is used to signal the duration, and success or failure, of the navigation. After it settles, the browser signals to the user (e.g., via a loading spinner UI, or assistive technology) that the navigation is finished. Additionally, it fires navigatesuccess or navigateerror events as appropriate, which other parts of the web application can respond to.

+ +

By default, using this method will cause focus to reset when any handlers' returned promises settle. Focus will be reset to the first element with the autofocus attribute set, or the body element if the attribute isn't present. The focusReset option can be set to "manual" to avoid this behavior.

+ +

By default, using this method will delay the browser's scroll restoration logic for "traverse" or "reload" navigations, or its scroll-reset/scroll-to-a-fragment logic for "push" or "replace" navigations, until any handlers' returned promises settle. The scroll option can be set to "manual" to turn off any browser-driven scroll behavior entirely for this navigation, or scroll() can be called before the promise settles to trigger this behavior early.

+ +

This method will throw a "SecurityError" DOMException if canIntercept is false, or if isTrusted is false. It will throw an "InvalidStateError" DOMException if not called synchronously, during event dispatch.

+
+ +
event.scroll()
+
+

For "traverse" or "reload" navigations, restores the scroll position using the browser's usual scroll restoration logic.

+ +

For "push" or "replace" navigations, either resets the scroll position to the top of the document or scrolls to the fragment specified by destination.url if there is one.

+ +

If called more than once, or called after automatic post-transition scroll processing has happened due to the scroll option bieng left as "after-transition", this method will throw an "InvalidStateError" DOMException.

+

The NavigationDestination { any getState(); }; -

The url getter steps are: TODO.

+
+
event.destination.url
+

The URL being navigated to.

+ +
event.destination.key
+

The value of the key property of the destination NavigationHistoryEntry, if this is a "traverse" navigation, or null otherwise.

+ +
event.destination.id
+

The value of the id property of the destination NavigationHistoryEntry, if this is a "traverse" navigation, or null otherwise.

+ +
event.destination.index
+

The value of the index property of the destination NavigationHistoryEntry, if this is a "traverse" navigation, or −1 otherwise.

+ +
event.destination.sameDocument
+
+

Indicates whether or not this navigation is to the same Document as the current one, or not. This will be true, for example, in the case of fragment navigations or history.pushState() navigations.

+ +

Note that this property indicates the original nature of the navigation. If a cross-document navigation is converted into a same-document navigation using navigateEvent.intercept(), that will not change the value of this property.

+
+ +
event.destination.getState()
+
+

For "traverse" navigations, returns the deserialization of the state stored in the destination session history entry.

+ +

For "push" or "replace" navigations, returns the deserialization of the state passed to navigation.navigate(), if the navigation was initiated by that method, or undefined it if it wasn't.

-

The key getter steps are: TODO.

+

For "reload" navigations, returns the deserialization of the state passed to navigation.reload(), if the reload was initiated by that method, or undefined it if it wasn't.

+
+
+ +

Each NavigationDestination has a URL, which is a URL.

+ +

Each NavigationDestination has a key, which is a string or null.

+ +

Each NavigationDestination has an ID, which is a string or null.

+ +

Each NavigationDestination has an index, which is an integer.

-

The id getter steps are: TODO.

+

Each NavigationDestination has a state, which is a serialized state.

-

The index getter steps are: TODO.

+

Each NavigationDestination has an is same document, which is a boolean.

-

The sameDocument getter steps are: TODO.

+

The url getter steps are to return this's URL, serialized.

-

The getState() method steps are: TODO.

+

The key getter steps are to return this's key.

+ +

The id getter steps are to return this's ID.

+ +

The index getter steps are to return this's index.

+ +

The sameDocument getter steps are to return this's is same document.

+ +

The getState() method steps are to return StructuredDeserialize(this's state).

+

The NavigateEvent interface has its own dedicated section, due to its complexity.

+
The NavigationCurrentEntryChangeEvent interface