Re: URL comparison

Le 25/04/2013 20:41, sam@cateches.is a écrit :
>> Requests I've heard before I looked at :local-link():
>>
>> * Simple equality
>> * Ignore fragment
>> * Ignore fragment and query
>> * Further normalization (browsers don't normalize as much as they
>> could during parsing, but maybe this should be an operation to modify
>> the URL object rather than a comparison option)
>
> What about links that point to a null URL with a hash? ie <a href="#back-to-top">
> Obviously this is a local link, but it doesn't really fit into the
> host/path/query segmentation that's defined with the :local-link([0|1|2...]) definition[1].
> Perhaps a :local-link(hash) keyword would be appropriate so that we could select links within the page?
>
> [1]http://dev.w3.org/csswg/selectors/#local-pseudo

Selectors 4 says "an element that is the source anchor of a hyperlink 
whose target's absolute URL matches the element's own document URL."

So the href attribute value would be parsed as an URL and made absolute 
per the usual rules before being matched by :link-local. In an HTML 
document, without a <base> element, the base URL would be the document 
URL and so :link-local would match.


>> However, :local-link() also ignores port/scheme which is not typical.
>
> Isn't it perfectly reasonable to expect that a different scheme/port
> is running an entirely different application?

I agree that Selectors 4 should be changed here. URLs that differ only 
by the scheme or port number should not be considered "local".

-- 
Simon Sapin

Received on Sunday, 5 May 2013 06:13:57 UTC