Skip to content

Commit e3093cf

Browse files
committed
[selectors-4] Add back definition for the (non-functional-notation) :local-link pseudo-class, adjust to account for fragment identifiers. Closes #2010.
1 parent f96f613 commit e3093cf

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

selectors-4/Overview.bs

+44-4
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,19 @@ Selectors Overview</h2>
237237
of which the target is already visited
238238
<td>[[#link]]
239239
<td>1
240+
<tr>
241+
<td><code>E:local-link</code>
242+
<td>an E element being the source anchor of a hyperlink
243+
targetting the current URL
244+
<td>[[#the-local-link-pseudo]]
240245
<tr>
241246
<td><code>E:target</code>
242-
<td>an E element being the target of the referring URL
247+
<td>an E element being the target of the current URL
243248
<td>[[#the-target-pseudo]]
244249
<td>3
245250
<tr>
246251
<td><code>E:target-within</code>
247-
<td>an E element that is the target of the referring URL or contains an element that does.
252+
<td>an E element that is the target of the current URL or contains an element that does.
248253
<td>[[#the-target-within-pseudo]]
249254
<td>4
250255
<tr>
@@ -1976,6 +1981,39 @@ The Link History Pseudo-classes: '':link'' and '':visited''</h3>
19761981
or implement other measures to preserve the user's privacy
19771982
while rendering visited and unvisited links differently.
19781983

1984+
<h3 id="the-local-link-pseudo">
1985+
The Local Link Pseudo-class: '':local-link''</h3>
1986+
1987+
The <dfn id='local-link-pseudo'>:local-link</dfn> pseudo-class
1988+
allows authors to style <a href="#the-any-link-pseudo">hyperlinks</a>
1989+
based on the users current location within a site.
1990+
It represents an element that is
1991+
the source anchor of a hyperlink whose target's absolute URL
1992+
matches the element's own document URL.
1993+
If the hyperlink's target includes a fragment URL,
1994+
then the fragment URL of the current URL must also match;
1995+
if it does not, then the fragment URL portion of the current URL
1996+
is not taken into account in the comparison.
1997+
1998+
<div class="example">
1999+
For example, the following rule prevents links targetting the
2000+
current page from being underlined when they are part of the
2001+
navigation list:
2002+
2003+
<pre>nav :local-link { text-decoration: none; } </pre>
2004+
</div>
2005+
2006+
Note: The current URL of a page can change as a result of user actions
2007+
such as activating a link targetting a different fragment within the same page;
2008+
or by use of the <code>pushState</code> API;
2009+
as well as by the more obvious actions of navigating to a different page
2010+
or following a redirect (which could be initiated by protocols such as HTTP,
2011+
markup instructions such as <code>&lt;meta http-equiv="..."></code>,
2012+
or scripting instructions <!-- such as ? -->).
2013+
UAs must ensure that '':local-link'',
2014+
as well as the '':target'' and '':target-within'' pseudo-classes below,
2015+
respond correctly to all such changes in state.
2016+
19792017
<h3 id="the-target-pseudo">
19802018
The Target Pseudo-class: '':target''</h3>
19812019

@@ -3748,8 +3786,10 @@ Changes</h2>
37483786

37493787
Issue: Do we have implementations of this? If not, maybe it's better to keep the restriction for level 4?
37503788
<li>Defined <a>specificity</a> of a <a>selector list</a>. (Why?)
3751-
<li>Required quotes around '':lang()'' values involving an asterisk.
3752-
<li>Removed the <css>:local-link</css> and reference combinator for lack of interest.
3789+
<li>Required quotes around '':lang()'' values involving an asterisk;
3790+
only language codes which happen to bhe CSS identifiers can be used unquoted.
3791+
<li>Changed the <css>:local-link</css> pseudo-class to account for fragment URLs.
3792+
<li>Removed the <code>:local-link()</code> pseudo-class and reference combinator for lack of interest.
37533793
</ul>
37543794

37553795

0 commit comments

Comments
 (0)