@@ -68,12 +68,12 @@ The ''@route'' rule can be defined in one of two ways:
6868: with the <code> pattern</code> descriptor
6969:: in this case the URL pattern represented is
7070 the one represented by the <<url-pattern()>> function
71- given as the descriptor's value.
71+ given as the descriptor's value.
7272: with the other descriptors named by <<init-descriptor-name>>
7373:: In this case the URL pattern represented is the result of invoking
74- [=URL pattern/create|create a URL pattern=] given
74+ [=URL pattern/create|create a URL pattern=] given
7575 <var> input</var> as {{URLPatternInit}}
76- constructed from the descriptors and their values;
76+ constructed from the descriptors and their values;
7777 if a <code> baseURL</code> descriptor is not given then one is created from
7878 the [=style resource base URL=] of the rule.
7979
@@ -185,14 +185,14 @@ The syntax of the ''@navigation'' rule is:
185185with <<navigation-condition>> defined as:
186186
187187<pre class="prod def" dfn-type="type" nohighlight>
188- <dfn><<navigation-condition>></dfn> = not <<navigation-in-parens>>
189- | <<navigation-in-parens>> [ and <<navigation-in-parens>> ]*
190- | <<navigation-in-parens>> [ or <<navigation-in-parens>> ]*
191- <dfn><<navigation-in-parens>></dfn> = ( <<navigation-condition>> ) | ( <<navigation-test>> ) | <<general-enclosed>>
192- <dfn><<navigation-test>></dfn> = <<navigation-location>> | <<navigation-keyword>> : <<navigation-location>>
193- <dfn><<navigation-keyword>></dfn> = at | from | to
194- <dfn><<navigation-location>></dfn> = <<route-name>> | <<url-pattern()>>
195- <dfn><<route-name>></dfn> = <<dashed-ident>>
188+ <dfn><<navigation-condition>></dfn> = not <<navigation-in-parens>>
189+ | <<navigation-in-parens>> [ and <<navigation-in-parens>> ]*
190+ | <<navigation-in-parens>> [ or <<navigation-in-parens>> ]*
191+ <dfn><<navigation-in-parens>></dfn> = ( <<navigation-condition>> ) | ( <<navigation-test>> ) | <<general-enclosed>>
192+ <dfn><<navigation-test>></dfn> = <<navigation-location>> | <<navigation-keyword>> : <<navigation-location>>
193+ <dfn><<navigation-keyword>></dfn> = at | from | to
194+ <dfn><<navigation-location>></dfn> = <<route-name>> | <<url-pattern()>>
195+ <dfn><<route-name>></dfn> = <<dashed-ident>>
196196</pre>
197197
198198The above grammar is purposely very loose for forwards-compatibility reasons,
@@ -231,106 +231,24 @@ as follows:
231231 :: The result is whether the result of
232232 [=URL pattern/match|match a URL pattern=] is non-null
233233 given <var> urlPattern</var> as
234- the [=navigation location URL pattern=] of <<navigation-location>> ,
235- <var> input</var> as the document's [=Document/URL=] .
234+ the [=navigation location URL pattern=] of <<navigation-location>>
235+ and <var> input</var> as the document's [=Document/URL=] .
236236
237237 : from: <<navigation-location>>
238238 :: The result is true if
239- the [=document's navigation API=] of the document
240- is non-null, and either:
241-
242- * its [=transition=] is non-null,
243- its [=from entry=] 's {{NavigationHistoryEntry/url}}
244- is non-null and
245- [=URL pattern/match|match a URL pattern=] is non-null when
246- given <var> urlPattern</var> as
247- the [=navigation location URL pattern=] of <<navigation-location>> ,
248- <var> input</var> as that
249- [=from entry=] 's {{NavigationHistoryEntry/url}} .
250-
251- NOTE: This part handles <code> from:</code> when it matches in the old page.
252-
253- * its [=activation=] is non-null,
254- the document's [=has been revealed=] is false or
255- was false at the start of the current [=task=] ,
256- and the activation's {{NavigationActivation/from}} 's
257- {{NavigationHistoryEntry/url}}
258- is non-null and
259- [=URL pattern/match|match a URL pattern=] is non-null when
260- given <var> urlPattern</var> as
261- the [=navigation location URL pattern=] of <<navigation-location>> ,
262- <var> input</var> as that
263- activation's {{NavigationActivation/from}} 's
264- {{NavigationHistoryEntry/url}} .
265-
266- NOTE: This part handles <code> from:</code> when it matches in the new page.
239+ the [=current from URL=] <var> from</var> of the document is non-null and
240+ [=URL pattern/match|match a URL pattern=] is non-null when
241+ given <var> urlPattern</var> as
242+ the [=navigation location URL pattern=] of <<navigation-location>>
243+ and <var> input</var> as <var> from</var> .
267244
268245 : to: <<navigation-location>>
269246 :: The result is true if
270- the [=document's navigation API=] of the document
271- is non-null, and either:
272-
273- * its [=ongoing navigate event=] is non-null,
274- [=URL pattern/match|match a URL pattern=] is non-null
275- given <var> urlPattern</var> as
276- the [=navigation location URL pattern=] of <<navigation-location>> ,
277- <var> input</var> as the [=current to url=] ,
278- where the <dfn>current to url</dfn> is defined as:
279-
280- * if the {{pageswap}} event has fired since that navigation began,
281- and its {{PageSwapEvent/activation}} was non-null,
282- and that {{PageSwapEvent/activation}} 's
283- {{NavigationActivation/entry}} 's
284- {{NavigationHistoryEntry/url}} is non-null,
285- then that
286- {{NavigationHistoryEntry/url}} .
287-
288- NOTE: This part <em> does</em> expose the result of redirects.
289-
290- ISSUE: Is the final "non-null" check needed?
291-
292- * otherwise, the [=ongoing navigate event=] 's
293- {{NavigateEvent/destination}} 's
294- {{NavigationDestination/url}}
295-
296- NOTE: This part does <em> not</em> expose the result of redirects.
297-
298- ISSUE: This assumes that the [=ongoing navigate event=]
299- and the [=transition=] have the same lifetime,
300- but this isn't really
301- true if the event is intercepted.
302- After
303- <a href="https://github.com/whatwg/html/issues/11690">whatwg/html#11690</a> /
304- <a href="https://github.com/whatwg/html/pull/11692">whatwg/html#11692</a> .
305- we could probably define this more like "from" above.
306- But which lifetime is the one we want?
307-
308- NOTE: This part handles <code> to:</code> when it matches in the old page.
309-
310- * its [=activation=] is non-null,
311- the document's [=has been revealed=] is false or
312- was false at the start of the current [=task=] ,
313- and the activation's {{NavigationActivation/entry}} 's
314- {{NavigationHistoryEntry/url}}
315- is non-null and
316- [=URL pattern/match|match a URL pattern=] is non-null
317- given <var> urlPattern</var> as
318- the [=navigation location URL pattern=] of <<navigation-location>> ,
319- <var> input</var> as that
320- activation's {{NavigationActivation/entry}} 's
321- {{NavigationHistoryEntry/url}} .
322-
323- NOTE: This part handles <code> to:</code> when it matches in the new page.
324-
325- ISSUE: The above definitions of from and to apparently don't work right
326- if you start a same-document navigation (e.g., with {{History/pushState}} )
327- in the middle of a cross-document navigation.
328-
329- ISSUE: Generally improve integration with the HTML spec for these definitions,
330- instead of monkeypatching.
331- This includes the interaction with [=has been revealed=]
332- and the interaction with the {{pageswap}} event,
333- and other things where this section links to non-exported definitions.
247+ the [=current to URL=] <var> to</var> of the document is non-null and
248+ [=URL pattern/match|match a URL pattern=] is non-null when
249+ given <var> urlPattern</var> as
250+ the [=navigation location URL pattern=] of <<navigation-location>>
251+ and <var> input</var> as <var> to</var> .
334252
335253: <<general-enclosed>>
336254::
@@ -539,11 +457,8 @@ if the following steps return true:
539457 1. If <<navigation-param>> is a <<navigation-param-function>> ,
540458 and <var> entry</var> 's [=map/key=] is the function' s <<ident>> ,
541459 then for each <var> navigationUrl</var> of the
542- current to URL
543- and current from URL
544- <span class="issue"> extract "current to URL" and
545- "current from URL" from ''@navigation''
546- definitions above and link to them</span> :
460+ [=current to URL=]
461+ and [=current from URL=] :
547462 1. Let <var> navigationMatchResult</var> be the result of
548463 [=URL pattern/match|match a URL pattern=]
549464 given <var> urlPattern</var> and <var> navigationUrl</var> .
@@ -554,20 +469,111 @@ if the following steps return true:
554469 whose [=map/key=] is the same as <var> entry</var> 's key
555470 and whose [=map/value=] is the same as <var> entry</var> 's value.
556471
557- NOTE: This step makes the ''navigation-param()'' function
558- perform what is essentially a three-way match,
559- between the target of the link,
560- the provided URL pattern,
561- and the from or to URL of the current navigation.
472+ NOTE: This step makes the ''navigation-param()'' function
473+ perform what is essentially a three-way match,
474+ between the target of the link,
475+ the provided URL pattern,
476+ and the from or to URL of the current navigation.
562477
563478ISSUE: A <<link-condition>> should also be able to be a named route
564479once those are added back to the spec.
565480
481+ <h2 id="current-nav-urls">Current navigation URLs</h2>
482+
483+ Both the ''@navigation'' rule and the '':link-to()'' pseudo-class
484+ rely on the following definitions of
485+ the [=current from URL=] and [=current to URL=] .
486+
487+ The <dfn>current from URL</dfn> of a [=/document=] is a URL or null.
488+ It is defined as follows:
489+
490+ 1. If the [=document's navigation API=] of the document is non-null and
491+ its [=transition=] is non-null,
492+ its [=from entry=] 's {{NavigationHistoryEntry/url}} .
493+
494+ NOTE: This part is for when the old document in the navigation
495+ is still the current document.
496+
497+ 1. If the [=document's navigation API=] of the document is non-null and
498+ its [=activation=] is non-null,
499+ the document's [=has been revealed=] is false or
500+ was false at the start of the current [=task=] ,
501+ the activation's {{NavigationActivation/from}} 's
502+ {{NavigationHistoryEntry/url}} .
503+
504+ NOTE: This part is for when the new document in the navigation
505+ has become the current document.
506+
507+ 1. Otherwise, null.
508+
509+ NOTE: The previous two branches can also produce null results.
510+
511+ The <dfn>current to URL</dfn> of a [=/document=] is a URL or null.
512+ It is defined as follows:
513+
514+ 1. If the [=document's navigation API=] of the document is non-null and
515+ its [=ongoing navigate event=] is non-null:
516+
517+ 1. if the {{pageswap}} event has fired since that navigation began,
518+ and its {{PageSwapEvent/activation}} was non-null,
519+ and that {{PageSwapEvent/activation}} 's
520+ {{NavigationActivation/entry}} 's
521+ {{NavigationHistoryEntry/url}} is non-null,
522+ then that
523+ {{NavigationHistoryEntry/url}} .
524+
525+ NOTE: This part <em> does</em> expose the result of redirects.
526+
527+ ISSUE: Is the final "non-null" check needed?
528+
529+ 1. otherwise, the [=ongoing navigate event=] 's
530+ {{NavigateEvent/destination}} 's
531+ {{NavigationDestination/url}}
532+
533+ NOTE: This part does <em> not</em> expose the result of redirects.
534+
535+ ISSUE: This assumes that the [=ongoing navigate event=]
536+ and the [=transition=] have the same lifetime,
537+ but this isn't really
538+ true if the event is intercepted.
539+ After
540+ <a href="https://github.com/whatwg/html/issues/11690">whatwg/html#11690</a> /
541+ <a href="https://github.com/whatwg/html/pull/11692">whatwg/html#11692</a> .
542+ we could probably define this more like "from" above.
543+ But which lifetime is the one we want?
544+
545+ NOTE: This part is for when the old document in the navigation
546+ is still the current document.
547+
548+ 1. If the [=document's navigation API=] of the document is non-null and
549+ its [=activation=] is non-null,
550+ the document's [=has been revealed=] is false or
551+ was false at the start of the current [=task=] ,
552+ and the activation's {{NavigationActivation/entry}} 's
553+ {{NavigationHistoryEntry/url}} .
554+
555+ NOTE: This part is for when the new document in the navigation
556+ has become the current document.
557+
558+ 1. Otherwise, null.
559+
560+ NOTE: The previous two branches can also produce null results.
561+
562+ ISSUE: The above definitions of from and to apparently don't work right
563+ if you start a same-document navigation (e.g., with {{History/pushState}} )
564+ in the middle of a cross-document navigation.
565+
566+ ISSUE: Generally improve integration with the HTML spec for these definitions,
567+ instead of monkeypatching.
568+ This includes the interaction with [=has been revealed=]
569+ and the interaction with the {{pageswap}} event,
570+ and other things where this section links to non-exported definitions.
571+
566572<h2 id="url-pattern-function">The ''url-pattern()'' function</h2>
567573
568574<!--
569575
570- NOTE: We may eventually want to move this to css-values.
576+ NOTE: We may eventually want to move this to css-values.
571577
572578If we do, the definition of "style resource base URL" probably doesn't need to be
573579exported any more, since it was exported for this definition.
@@ -612,7 +618,7 @@ using the steps of the <dfn>create a URL pattern for url-pattern()</dfn> algorit
6126181. Return the result of [=URL pattern/create|create a URL pattern=] given
613619 <var> arg</var> , <var> baseURL</var> , and an empty [=map=] .
614620
615- NOTE: This function requires that its argument is quoted.
621+ NOTE: This function requires that its argument is quoted.
616622This differs from the ''url()'' function,
617623which allows its argument to be quoted or unquoted.
618624
0 commit comments