- From: Anne van Kesteren <annevk@annevk.nl>
- Date: Thu, 25 Apr 2013 12:34:11 +0100
- To: "www-style@w3.org" <www-style@w3.org>, WebApps WG <public-webapps@w3.org>
Background reading: http://dev.w3.org/csswg/selectors/#local-pseudo and http://url.spec.whatwg.org/ :local-link() seems like a special case API for doing URL comparison within the context of selectors. It seems like a great feature, but I'd like it if we could agree on common comparison rules so that when we eventually introduce the JavaScript equivalent they're not wildly divergent. Requests I've heard before I looked at :local-link(): * Simple equality * Ignore fragment * Ignore fragment and query * Compare query, but ignore order (e.g. ?x&y will be identical to ?y&x, which is normally not the case) * Origin equality (ignores username/password/path/query/fragment) * 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) :local-link() seems to ask for: Ignore fragment and query and only look at a subset of path segments. However, :local-link() also ignores port/scheme which is not typical. We try to keep everything origin-scoped (ignoring username/password probably makes sense). Furthermore, :local-link() ignores a final empty path segment, which seems to mimic some popular server architectures (although those ignore most empty path segments, not just the final), but does not match URL architecture. For JavaScript I think the basic API will have to be something like: url.equals(url2, {query:"ignore-order"}) url.equals(url2, {query:"ignore-order", upto:"fragment"}) // ignores fragment url.equals(url2, {upto:"path"}) // compares everything before path, including username/password url.origin == url2.origin // ignores username/password url.equals(url2, {pathSegments:2}) // implies ignoring query/fragment or some such. Better ideas more than welcome. -- http://annevankesteren.nl/
Received on Thursday, 25 April 2013 11:34:39 UTC