Skip to content

Commit 60501e8

Browse files
committed
[css-navigation-1] Drop match-pattern/params/url from :link-to() and restructure.
This change: * drops the match-pattern/match-params/match-url from :link-to(), leaving the match-params behavior as the only option, * moves the at/with/to/from relation from inside the match-* function to before the route, and * drops the navigation-* prefix from the at/with/to/from relation. This is in preparation for a future change which will split :link-to() into :link-to() and :active-navigation().
1 parent 7f4a800 commit 60501e8

1 file changed

Lines changed: 24 additions & 44 deletions

File tree

css-navigation-1/Overview.bs

Lines changed: 24 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,8 @@ by matching the relevant parts of the navigation URL to the link URL.
431431
/* match URLs like /en/movie/123 which is the English page
432432
about a movie with ID 123. Be careful to specify the
433433
language part with a "*" but the ID part with a named
434-
:id parameter so that matching using the 'match-params'
435-
keyword (the default) will require equal IDs but allow
436-
differences of language. */
434+
:id parameter so that matching will require equal IDs
435+
but allow differences of language. */
437436
pattern: url-pattern("/*/movie/:id");
438437
}
439438

@@ -447,7 +446,7 @@ by matching the relevant parts of the navigation URL to the link URL.
447446

448447
This depends on the --movie-details-with-id route
449448
declaring the ID but not the language with a named
450-
parameter, and the use of match-params(navigation-with).
449+
parameter, and the use of the 'with' keyword.
451450

452451
This means that both the of the link and the other URL of
453452
the current navigation match the URL pattern defined by
@@ -457,8 +456,7 @@ by matching the relevant parts of the navigation URL to the link URL.
457456
match, containing the language, can be different.)
458457
*/
459458
.movie-container:has(
460-
> .movie-title:link-to(--movie-details-with-id
461-
with match-params(navigation-with))) {
459+
> .movie-title:link-to(with --movie-details-with-id)) {
462460

463461
view-transition-name: movie-container;
464462

@@ -479,14 +477,9 @@ and the pseudo-class matches any element where:
479477
* the target of link matches the <<link-condition>>, as defined below.
480478

481479
<pre class="prod def" dfn-type="type" nohighlight>
482-
<dfn><<link-condition>></dfn> = <<link-condition-base>> [ with <<navigation-match>> ]?
480+
<dfn><<link-condition>></dfn> = [ <<navigation-relation>> ]? <<link-condition-base>>
483481
<dfn><<link-condition-base>></dfn> = <<navigation-location>>
484-
// Note: <<navigation-match>> is defining three functions
485-
// with identical syntax.
486-
<dfn><<navigation-match>></dfn> = <<pattern-match-type>>( <<navigation-match-target>> )
487-
<dfn><<pattern-match-type>></dfn> = match-pattern | match-params | match-url
488-
<dfn><<navigation-match-target>></dfn> = navigation-at | navigation-with |
489-
navigation-from | navigation-to
482+
<dfn><<navigation-relation>></dfn> = at | with | from | to
490483
</pre>
491484

492485
ISSUE: Should we use ''navigation-''(''at''/''with''/''from''/''to'') or
@@ -526,49 +519,36 @@ if the following steps return true:
526519

527520
NOTE: This doesn't really matter because
528521
in this case the <<link-condition-base>> also doesn't match.
529-
1. Let <var>matchType</var> be the <<pattern-match-type>> of the
530-
<<navigation-match>>.
531-
1. Let <var>matchTarget</var> be the <<navigation-match-target>> argument
522+
1. Let <var>matchRelation</var> be the <<navigation-relation>> argument
532523
of the <<navigation-match>>.
533524
1. Let <var>navigationURL</var> be:
534-
: If <var>matchTarget</var> is ''navigation-at'',
525+
: If <var>matchRelation</var> is ''at'',
535526
:: the document's [[=Document/URL=]].
536-
: Otherwise, if <var>matchTarget</var> is ''navigation-with'',
527+
: Otherwise, if <var>matchRelation</var> is ''with'',
537528
:: the <a>current other URL</a> of the document.
538-
: Otherwise, if <var>matchTarget</var> is ''navigation-from'',
529+
: Otherwise, if <var>matchRelation</var> is ''from'',
539530
:: the <a>current from URL</a> of the document.
540-
: Otherwise (Assert: <var>matchTarget</var> is ''navigation-to''),
531+
: Otherwise (Assert: <var>matchRelation</var> is ''to''),
541532
:: the <a>current to URL</a> of the document.
542533
1. If <var>navigationURL</var> is null, return false.
543-
1. : If <var>matchType</var> is ''match-pattern''
544-
:: Return true if
545-
the result of [=URL pattern/match|match a URL pattern=] given
546-
<var>urlPattern</var> and <var>navigationURL</var> is not null;
547-
otherwise return false.
534+
1. Let <var>navigationMatchResult</var> be the result of
535+
[=URL pattern/match|match a URL pattern=] given
536+
<var>navigationURL</var> and <var>urlPattern</var>.
548537

549-
: If <var>matchType</var> is ''match-params''
550-
:: 1. Let <var>navigationMatchResult</var> be the result of
551-
[=URL pattern/match|match a URL pattern=] given
552-
<var>navigationURL</var> and <var>urlPattern</var>.
538+
1. If <var>navigationMatchResult</var> is null, return false.
553539

554-
1. If either <var>navigationMatchResult</var> is null, return false.
540+
1. For each property <var>prop</var> of {{URLPatternResult}} that is a
541+
{{URLPatternComponentResult}}:
555542

556-
1. For each property <var>prop</var> of {{URLPatternResult}} that is a
557-
{{URLPatternComponentResult}}:
543+
1. If {{URLPatternComponentResult/groups}} of <var>prop</var> of
544+
<var>targetMatchResult</var> is not equal to
545+
{{URLPatternComponentResult/groups}} of <var>prop</var> of
546+
<var>navigationMatchResult</var>,
547+
then return false.
558548

559-
1. If {{URLPatternComponentResult/groups}} of <var>prop</var> of
560-
<var>targetMatchResult</var> is not equal to
561-
{{URLPatternComponentResult/groups}} of <var>prop</var> of
562-
<var>navigationMatchResult</var>,
563-
then return false.
549+
ISSUE: Need to formally define equality of ordered maps.
564550

565-
ISSUE: Need to formally define equality of ordered maps.
566-
567-
1. Return true.
568-
569-
: If <var>matchType</var> is ''match-url''
570-
:: Return true if <var>linkTarget</var> equals <var>navigationURL</var>;
571-
otherwise return false.
551+
1. Return true.
572552

573553
NOTE: Some of the design discussion for this feature has been in
574554
<a href="https://github.com/w3c/csswg-drafts/issues/13163">w3c/csswg-drafts#13163</a>.

0 commit comments

Comments
 (0)