Skip to content

Commit 15355af

Browse files
committed
[css-navigation-1] Fill in definitions of from and to.
(This is part of importing the history from WICG/declarative-partial-updates.)
1 parent 1f85844 commit 15355af

File tree

1 file changed

+48
-7
lines changed

1 file changed

+48
-7
lines changed

css-navigation-1/Overview.bs

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ Abstract: This module contains conditional CSS rules for styling based on routes
1616
</pre>
1717
<!-- for now using Org: w3c rather than Group: csswg because the latter forces an incorrect issue tracking link, overriding Repository -->
1818

19+
<!-- FIXME: TEMPORARILY override non-exported definition -->
20+
<pre class=anchors>
21+
url: https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationtransition-from
22+
type: dfn; spec: html; text: from entry;
23+
url: https://html.spec.whatwg.org/multipage/nav-history-apis.html#window-navigation-api
24+
type: dfn; spec: html; text: navigation API;
25+
url: https://html.spec.whatwg.org/multipage/nav-history-apis.html#ongoing-navigate-event
26+
type: dfn; spec: html; text: ongoing navigate event;
27+
url: https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigation-transition
28+
type: dfn; spec: html; text: transition;
29+
</pre>
30+
1931
<h2 id="at-route">Route queries: the ''@route'' rule</h2>
2032

2133
The <dfn at-rule id="at-ruledef-route">@route</dfn> rule
@@ -59,7 +71,7 @@ with <<route-condition>> defined as:
5971
| <<route-in-parens>> [ or <<route-in-parens>> ]*
6072
<dfn><<route-in-parens>></dfn> = ( <<route-condition>> ) | ( <<route-test>> ) | <<general-enclosed>>
6173
<dfn><<route-test>></dfn> = <<route-name>> | <<route-keyword>> : <<route-name>>
62-
<dfn><<route-keyword>></dfn> = at | to | from
74+
<dfn><<route-keyword>></dfn> = at | from | to
6375
<!-- TODO(dbaron): Should this be <<ident>> or <<custom-ident>> ? -->
6476
<dfn><<route-name>></dfn> = <<custom-ident>>
6577
</pre>
@@ -107,22 +119,43 @@ as follows:
107119
the URL pattern of a route named <<route-name>>
108120
declared in a <code highlight=html>&lt;script type=routemap></code>.
109121

110-
: to: <<route-name>>
122+
: from: <<route-name>>
111123
:: The result is true if
112-
the document's [=node navigable=]'s
113-
@@@ @@@ <span class="issue">define this properly</span>
124+
the [=document's navigation API=] of the document
125+
is non-null,
126+
its [=transition=] is non-null,
127+
its [=from entry=]'s {{NavigationHistoryEntry/url}}
128+
is non-null and
114129
[=URL pattern/match|matches=]
115130
the URL pattern of a route named <<route-name>>
116131
declared in a <code highlight=html>&lt;script type=routemap></code>.
117132

118-
: from: <<route-name>>
133+
: to: <<route-name>>
119134
:: The result is true if
120-
the document's [=node navigable=]'s
121-
@@@ @@@ <span class="issue">define this properly</span>
135+
the [=document's navigation API=] of the document
136+
is non-null,
137+
its [=ongoing navigate event=] is non-null,
138+
and its {{NavigateEvent/destination}}'s
139+
{{NavigationDestination/url}}
122140
[=URL pattern/match|matches=]
123141
the URL pattern of a route named <<route-name>>
124142
declared in a <code highlight=html>&lt;script type=routemap></code>.
125143

144+
<!--
145+
146+
After
147+
<a href="https://github.com/whatwg/html/issues/11690">whatwg/html#11690</a> /
148+
<a href="https://github.com/whatwg/html/pull/11692">whatwg/html#11692</a>.
149+
we could probably define this more like "from" above. But it's probably
150+
also OK as is since the transition and the ongoing navigate event basically have
151+
the same lifetime.
152+
153+
-->
154+
155+
ISSUE: The above definitions of from and to probably don't do the right thing
156+
during the loading of the new document in a cross-document navigation,
157+
since I think they reference concepts that are only present on the old document.
158+
126159
ISSUE: Once routemaps are defined more formally,
127160
this should be defined in terms of the routemap definition
128161
instead of referring directly to URLPattern.
@@ -135,6 +168,14 @@ as follows:
135168
<span class='note'>It exists only for future-compatibility,
136169
so that new syntax additions do not invalidate too much of a <<route-condition>> in older user agents.</span>
137170

171+
Define a <dfn>document's navigation API</dfn> as the result of the following steps on <var>document</var>:
172+
173+
1. Let <var>window</var> be the {{Window}} whose [=associated Document=] is <var>document</var>, or null if there is no such {{Window}}.
174+
175+
1. If <var>window</var> is null, return null.
176+
177+
1. Return <var>window</var>'s [=navigation API=].
178+
138179
The condition of the ''@route'' rule
139180
is the result of the <<route-condition>> in its prelude.
140181

0 commit comments

Comments
 (0)