Re: [selectors] Self-referential link pseudo-class

Also, I’m not sure how one would target only the exact URL that you are currently on (excluding hash, etc)?

In my previous example:

>>> <ul>
>>> 	<li><a href=“home.html“>Home</a></li>
>>> 	<li><a href=“about.html“>About us</a></li>
>>> </ul>

…when on home.html, how would style just that link?

Thanks,

AK

On 7 May 2014, at 12:44, Antony Kennedy <antony@silversquid.com> wrote:

> Brilliant, thanks for that Simon.
> 
> I love the idea of the argument, but seems like it should target TLD, FQDN, everything up until the querystring, and then everything (always excluding the hash).
> 
> Then you could target:
> mydomain.com
> sub.mydomain.com
> sub.mydomain.com/product
> sub.mydomain.com/product?id=123
> I’m not sure how one would accomplish this without multiple arguments, or multiple pseudo-classes.
> 
> Will we be revisiting this any time soon? This has been an issue since HTML 2.0. :)
> 
> AK
> 
> On 7 May 2014, at 12:35, Simon Sapin <simon.sapin@exyr.org> wrote:
> 
>> On 07/05/2014 09:59, Antony Kennedy wrote:
>>> Hello.
>>> 
>>> It’s a common issue to try to figure out how to specifically style
>>> the link that points to the current URL, for example, in a navigation
>>> list:
>>> 
>>> <ul>
>>> 	<li><a href=“/“>Home</a></li>
>>> 	<li><a href=“about“>About us</a></li>
>>> </ul>
>>> 
>>> Typically this is dealt with by adding class=“active” or something
>>> similar to the link that points to the current URL, or by removing
>>> the link altogether, but there is no standardised practise for
>>> self-referential links.
>>> 
>>> What does everyone think of something like :current or :self as a
>>> anchor pseudo-class to easily style links that point to the current
>>> URL?
>>> 
>>> This should ignore hashes appended to the location, but probably not
>>> querystrings etc.
>>> 
>>> I’d love to hear everyone’s opinion.
>> 
>> Until recently, the Selectors spec had a :local-link pseudo-class. You can find it’s definition here:
>> 
>> http://www.w3.org/TR/2013/WD-selectors4-20130502/#local-pseudo
>> 
>> It was deferred to Level 5, since some of its details were still uncertain and we’re trying to stabilize Level 4.
>> 
>> -- 
>> Simon Sapin
> 

Received on Wednesday, 7 May 2014 11:47:09 UTC