Skip to content

Commit 7f796f7

Browse files
committed
Pull <<navigation-location>> into its own section and rename to <<route-location>>.
This type is common to multiple features in this spec and thus probably belongs in its own section rather than in the section of one of the features that uses it.
1 parent 6dcd08f commit 7f796f7

1 file changed

Lines changed: 58 additions & 52 deletions

File tree

css-navigation-1/Overview.bs

Lines changed: 58 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ url: https://drafts.csswg.org/css-view-transitions-1/#capture-the-image
3535
type: dfn; spec: css-view-transitions-1; text: capture the image;
3636
</pre>
3737

38-
<h2 id="at-route">Declaring named URL patterns: the ''@route'' rule</h2>
38+
<h2 id="url-patterns-in-css">Defining URL patterns in CSS</h2>
39+
40+
<h3 id="at-route">Declaring named URL patterns: the ''@route'' rule</h3>
3941

4042
The <dfn at-rule id="at-ruledef-route">@route</dfn> rule
4143
is an at-rule that associates a name with a [=URL pattern=].
@@ -127,6 +129,42 @@ NOTE: The bracing syntax also allows for future expansion if needed.
127129
NOTE: Some of the design discussion for this feature has been in
128130
<a href="https://github.com/w3c/csswg-drafts/issues/12594">w3c/csswg-drafts#12594</a>.
129131

132+
<h3 id="route-value-type">The <<route-location>> value type</h3>
133+
134+
<pre class="prod def" dfn-type="type" nohighlight>
135+
<dfn><<route-location>></dfn> = <<route-name>> | <<url-pattern()>> | <<url>>
136+
<dfn><<route-name>></dfn> = <<dashed-ident>>
137+
</pre>
138+
139+
A <<route-location>> is defined to
140+
<dfn for="route-location">match</dfn> a URL <var>input</var> if:
141+
142+
<dl class=switch>
143+
144+
: the <<route-location>> is a <<route-name>>
145+
:: [=URL pattern/match|match a URL pattern=] is non-null given
146+
<var>urlPattern</var> as
147+
the [=URL pattern=] represented by the ''@route'' rule referenced by the name and
148+
<var>input</var> as <var>input</var>.
149+
150+
: the <<route-location>> is a <<url-pattern()>>
151+
:: [=URL pattern/match|match a URL pattern=] is non-null given
152+
<var>urlPattern</var> as
153+
the [=URL pattern=] represented by the function (see
154+
[=create a URL pattern for url-pattern()=]) and
155+
<var>input</var> as <var>input</var>.
156+
157+
: the <<route-location>> is a <<url>>
158+
:: The given URL [=url/equals=] <var>input</var>.
159+
160+
</dl>
161+
162+
ISSUE: Should it also be possible to reference
163+
a name defined in a routemap?
164+
See the
165+
<a href="https://github.com/WICG/declarative-partial-updates/blob/main/route-matching-explainer.md">route matching explainer</a>
166+
for details.
167+
130168
<h2 id="conditional-navigation-queries">Conditional rules for navigation queries</h2>
131169

132170
<h3 id="at-navigation">Navigation queries: the ''@navigation'' rule</h3>
@@ -222,13 +260,11 @@ with <<navigation-condition>> defined as:
222260
<<navigation-location-between-test>> |
223261
<<navigation-type-test>>
224262
225-
<dfn><<navigation-location-test>></dfn> = <<navigation-location-keyword>> : <<navigation-location>>
263+
<dfn><<navigation-location-test>></dfn> = <<navigation-location-keyword>> : <<route-location>>
226264
<dfn><<navigation-location-keyword>></dfn> = at | with | from | to
227-
<dfn><<navigation-location>></dfn> = <<route-name>> | <<url-pattern()>> | <<url>>
228-
<dfn><<route-name>></dfn> = <<dashed-ident>>
229265
230266
<dfn><<navigation-location-between-test>></dfn> =
231-
between : <<navigation-location>> and <<navigation-location>>
267+
between : <<route-location>> and <<route-location>>
232268
233269
<dfn><<navigation-type-test>></dfn> = history : <<navigation-type-keyword>>
234270
<dfn><<navigation-type-keyword>></dfn> = traverse | back | forward | reload
@@ -267,35 +303,35 @@ as follows:
267303
:: The result is the result of the child subexpression.
268304

269305
: <<navigation-location-test>>
270-
:: : at: <<navigation-location>>
306+
:: : at: <<route-location>>
271307
:: The result is true if
272308
the [=current at URL=] <var>at</var> of the document is non-null and
273-
the <<navigation-location>> [=navigation-location/matches=] <var>at</var>.
309+
the <<route-location>> [=route-location/matches=] <var>at</var>.
274310

275-
: with: <<navigation-location>>
311+
: with: <<route-location>>
276312
:: The result is true if
277313
the [=current with URL=] <var>other</var> of the document is non-null and
278-
the <<navigation-location>> [=navigation-location/matches=] <var>other</var>.
314+
the <<route-location>> [=route-location/matches=] <var>other</var>.
279315

280-
: from: <<navigation-location>>
316+
: from: <<route-location>>
281317
:: The result is true if
282318
the [=current from URL=] <var>from</var> of the document is non-null and
283-
the <<navigation-location>> [=navigation-location/matches=] <var>from</var>.
319+
the <<route-location>> [=route-location/matches=] <var>from</var>.
284320

285-
: to: <<navigation-location>>
321+
: to: <<route-location>>
286322
:: The result is true if
287323
the [=current to URL=] <var>to</var> of the document is non-null and
288-
the <<navigation-location>> [=navigation-location/matches=] <var>to</var>.
324+
the <<route-location>> [=route-location/matches=] <var>to</var>.
289325

290326
: <<navigation-location-between-test>>
291-
:: : between: <<navigation-location>> and <<navigation-location>>
327+
:: : between: <<route-location>> and <<route-location>>
292328
:: The result is true if
293329
the [=current from URL=] <var>from</var> of the document is non-null,
294330
the [=current to URL=] <var>to</var> of the document is non-null,
295-
one of the two <<navigation-location>>s
296-
[=navigation-location/matches=] <var>from</var>,
297-
and the other of the two <<navigation-location>>s
298-
[=navigation-location/matches=] <var>to</var>.
331+
one of the two <<route-location>>s
332+
[=route-location/matches=] <var>from</var>,
333+
and the other of the two <<route-location>>s
334+
[=route-location/matches=] <var>to</var>.
299335

300336
: <<navigation-type-test>>
301337
:: : history: traverse
@@ -317,36 +353,6 @@ as follows:
317353
<span class='note'>It exists only for future-compatibility,
318354
so that new syntax additions do not invalidate too much of a <<navigation-condition>> in older user agents.</span>
319355

320-
A <<navigation-location>> is defined to
321-
<dfn for="navigation-location">match</dfn> a URL <var>input</var> if:
322-
323-
<dl class=switch>
324-
325-
: the <<navigation-location>> is a <<route-name>>
326-
:: [=URL pattern/match|match a URL pattern=] is non-null given
327-
<var>urlPattern</var> as
328-
the [=URL pattern=] represented by the ''@route'' rule referenced by the name and
329-
<var>input</var> as <var>input</var>.
330-
331-
: the <<navigation-location>> is a <<url-pattern()>>
332-
:: [=URL pattern/match|match a URL pattern=] is non-null given
333-
<var>urlPattern</var> as
334-
the [=URL pattern=] represented by the function (see
335-
[=create a URL pattern for url-pattern()=]) and
336-
<var>input</var> as <var>input</var>.
337-
338-
: the <<navigation-location>> is a <<url>>
339-
:: The given URL [=url/equals=] <var>input</var>.
340-
341-
</dl>
342-
343-
ISSUE: Should it also be possible to reference
344-
a name defined in a routemap?
345-
See the
346-
<a href="https://github.com/WICG/declarative-partial-updates/blob/main/route-matching-explainer.md">route matching explainer</a>
347-
for details.
348-
349-
350356
A <dfn>document's navigation API</dfn> is
351357
the result of the following steps on <var>document</var>:
352358

@@ -409,10 +415,10 @@ which matches any links that link to the site's homepage:
409415

410416
</div>
411417

412-
The '':link-to()'' pseudo-class takes a single argument, a <<navigation-location>>,
418+
The '':link-to()'' pseudo-class takes a single argument, a <<route-location>>,
413419
and the pseudo-class matches any element where both:
414420
* the element matches '':any-link''
415-
* the <<navigation-location>> [=navigation-location/matches=] the target of the link
421+
* the <<route-location>> [=route-location/matches=] the target of the link
416422

417423
<h3 id="active-navigation-pseudo-class">The ''::active-navigation()'' pseudo-class</h3>
418424

@@ -492,7 +498,7 @@ and the pseudo-class matches any element where:
492498

493499
<pre class="prod def" dfn-type="type" nohighlight>
494500
<dfn><<active-navigation-condition>></dfn> =
495-
<<navigation-relation>>? [ <<navigation-location>> | link-href ]?
501+
<<navigation-relation>>? [ <<route-location>> | link-href ]?
496502
<dfn><<navigation-relation>></dfn> = at | with | from | to
497503
</pre>
498504

@@ -519,7 +525,7 @@ the following steps return true:
519525
1. Let <var>navigationURL</var> be
520526
the [=active navigation URL=] of the <<active-navigation-condition>>
521527
1. If <var>navigationURL</var> is null, return false.
522-
1. If a <<navigation-location>> is present:
528+
1. If a <<route-location>> is present:
523529
1. Let <var>targetMatchResult</var> be the result of
524530
[=URL pattern/match|match a URL pattern=]
525531
given <var>urlPattern</var> and <var>linkTarget</var>.

0 commit comments

Comments
 (0)