Skip to content

Commit b2cf1e0

Browse files
committed
[css-navigation-1] Allow urlpattern() in addition to route names.
(This is part of importing the history from WICG/declarative-partial-updates.)
1 parent a956843 commit b2cf1e0

File tree

1 file changed

+58
-16
lines changed

1 file changed

+58
-16
lines changed

css-navigation-1/Overview.bs

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ with <<route-condition>> defined as:
7070
| <<route-in-parens>> [ and <<route-in-parens>> ]*
7171
| <<route-in-parens>> [ or <<route-in-parens>> ]*
7272
<dfn><<route-in-parens>></dfn> = ( <<route-condition>> ) | ( <<route-test>> ) | <<general-enclosed>>
73-
<dfn><<route-test>></dfn> = <<route-name>> | <<route-keyword>> : <<route-name>>
73+
<dfn><<route-test>></dfn> = <<route-location>> | <<route-keyword>> : <<route-location>>
7474
<dfn><<route-keyword>></dfn> = at | from | to
75+
<dfn><<route-location>></dfn> = <<route-name>> | <<urlpattern()>>
7576
<!-- TODO(dbaron): Should this be <<ident>> or <<custom-ident>> ? -->
7677
<dfn><<route-name>></dfn> = <<custom-ident>>
7778
</pre>
@@ -112,34 +113,31 @@ as follows:
112113
:: The result is the result of the child subexpression.
113114

114115
: <<route-test>>
115-
:: : <<route-name>>
116-
: at: <<route-name>>
116+
:: : <<route-location>>
117+
: at: <<route-location>>
117118
:: The result is true if
118119
the document's [=Document/URL=] [=URL pattern/match|matches=]
119-
the URL pattern of a route named <<route-name>>
120-
declared in a <code highlight=html>&lt;script type=routemap></code>.
120+
the [=route location URL pattern=] of <<route-location>>.
121121

122-
: from: <<route-name>>
122+
: from: <<route-location>>
123123
:: The result is true if
124124
the [=document's navigation API=] of the document
125125
is non-null,
126126
its [=transition=] is non-null,
127127
its [=from entry=]'s {{NavigationHistoryEntry/url}}
128128
is non-null and
129129
[=URL pattern/match|matches=]
130-
the URL pattern of a route named <<route-name>>
131-
declared in a <code highlight=html>&lt;script type=routemap></code>.
130+
the [=route location URL pattern=] of <<route-location>>.
132131

133-
: to: <<route-name>>
132+
: to: <<route-location>>
134133
:: The result is true if
135134
the [=document's navigation API=] of the document
136135
is non-null,
137136
its [=ongoing navigate event=] is non-null,
138137
and its {{NavigateEvent/destination}}'s
139138
{{NavigationDestination/url}}
140139
[=URL pattern/match|matches=]
141-
the URL pattern of a route named <<route-name>>
142-
declared in a <code highlight=html>&lt;script type=routemap></code>.
140+
the [=route location URL pattern=] of <<route-location>>.
143141

144142
<!--
145143

@@ -160,10 +158,6 @@ as follows:
160158
if you start a same-document navigation (e.g., with {{History/pushState}})
161159
in the middle of a cross-document navigation.
162160

163-
ISSUE: Once routemaps are defined more formally,
164-
this should be defined in terms of the routemap definition
165-
instead of referring directly to URLPattern.
166-
167161
: <<general-enclosed>>
168162
::
169163
The result is false.
@@ -172,7 +166,23 @@ as follows:
172166
<span class='note'>It exists only for future-compatibility,
173167
so that new syntax additions do not invalidate too much of a <<route-condition>> in older user agents.</span>
174168

175-
Define a <dfn>document's navigation API</dfn> as the result of the following steps on <var>document</var>:
169+
The <dfn>route location URL pattern</dfn> of a <<route-location>>
170+
depends on the type of <<route-location>>:
171+
172+
: <<route-name>>
173+
:: the URL pattern of a route named <<route-name>>
174+
declared in a <code highlight=html>&lt;script type=routemap></code>.
175+
176+
ISSUE: Once routemaps are defined more formally,
177+
this should be defined in terms of the routemap definition
178+
instead of referring directly to URLPattern.
179+
180+
: <<urlpattern()>>
181+
:: The [=URL pattern=] represented by the function; see
182+
[=create a URL pattern for urlpattern()=].
183+
184+
A <dfn>document's navigation API</dfn> is
185+
the result of the following steps on <var>document</var>:
176186

177187
1. Let <var>window</var> be the {{Window}} whose [=associated Document=] is <var>document</var>, or null if there is no such {{Window}}.
178188

@@ -183,3 +193,35 @@ Define a <dfn>document's navigation API</dfn> as the result of the following ste
183193
The condition of the ''@route'' rule
184194
is the result of the <<route-condition>> in its prelude.
185195

196+
<h2 id="urlpattern-function">The ''urlpattern()'' function</h2>
197+
198+
<!--
199+
200+
NOTE: We may eventually want to move this to css-values.
201+
202+
If we do, the definition of "style resource base URL" probably doesn't need to be
203+
exported any more, since it was exported for this definition.
204+
205+
-->
206+
207+
The <dfn function>urlpattern()</dfn> function represents a [=URL pattern=],
208+
which can be used to match URLs.
209+
210+
<pre class="prod def">
211+
<<urlpattern()>> = urlpattern( <<string>> )
212+
</pre>
213+
214+
This function represents a [=URL pattern=] that can be created
215+
using the steps of the <dfn>create a URL pattern for urlpattern()</dfn> algorithm:
216+
217+
1. Let <var>arg</var> be the <<string>> argument to the ''urlpattern()'' function.
218+
219+
1. Let <var>baseURL</var> be the [=style resource base URL=] of
220+
the rule or declaration block containing the ''urlpattern()'' function.
221+
222+
1. Return the result of [=URL pattern/create|create a URL pattern=] given
223+
<var>arg</var>, <var>baseURL</var>, and an empty [=map=].
224+
225+
NOTE: This function requires that its argument is quoted.
226+
This differs from the ''url()'' function,
227+
which allows its argument to be quoted or unquoted.

0 commit comments

Comments
 (0)