- From: Christoph Päper <christoph.paeper@crissov.de>
- Date: Wed, 15 Feb 2012 21:23:00 +0100
- To: www-style list <www-style@w3.org>
fantasai: > - Need a URL expert to review http://dev.w3.org/csswg/selectors4/#local-pseudo I’m not one, but please let me add some thought anyway. Most (absolute) Web addresses that are used within documents that have CSS stylesheets attached to them use a subset of the following pattern scheme ‘:’ ‘//’ [ creds ‘@’ ]? server [ ‘/’ path ]? [ ‘?’ query ]? [ ‘#’ fragment ]? where scheme > protocol creds := user [ ‘:’ password ]? server := domain [ ‘:’ port ]? domain := name | number name := [ level ‘.’ ]+ level # DNS hierarchic number := [ bytedigit ‘.’ ]**4 # IPv4 numeric address | [ ‘[’ [ hexdigit**4 ‘:’ ]**7 hexdigit**4 ‘]’ ] # simplified IPv6 path := [ folder ‘/’ ]* [ file [ ‘.’ ext ]* ]? query := key [ ‘=’ value ]? [ [‘;’/‘&’] key [ ‘=’ value ]? ]* Using the current design of ‘:local-link’ and ‘:local-link(<number>)’ you can match for anything on the same “server” (0) and further specify this with the required level of matching folders in the path hierarchy, starting at the top (i.e. left). This doesn’t cover the following common patterns, sometimes considered “local”: a) 1) en.example.tld de.example.tld 2) www.example.tld blog.example.tld b) example.com example.org c) combinations of a) and b) d) http://example.tld https://example.tld ftp://example.tld e) example.tld:80 example.tld (which defaults to 80) f) localhost 127.0.0.1 ::::127.0.0.1 etc. I’m not sure ‘:local-link(0)’ ignores “userinfo”, e.g. email addresses, g) alice@example.tld bob@example.tld example.tld Therefore I think Selectors4 should only add ‘:local-link’ without parentheses and parameter. Selectors5 should add ‘:same-link()’ or some such where you can specify which parts should match. The first parameter names address parts that must match, the second parameter – they are separated by a comma – lists parts that may mismatch (and don’t by default). The second parameter is optional. The ‘path’ and ‘domain’ keywords may be followed by either a positive number (starting at their boundary at ‘/’) or negative number (starting at the most specific level), paths are divided by ‘/’ (maybe allow ‘\’ and ‘:’ too), domains are divided by ‘.’ or ‘:’ (IPv6). (Maybe add ‘.’ separated ‘ext’, too, for “index.html.en’ / ‘index.html.de’.) The number is in an+b form, known from ‘:nth-*’. a) :same-link(domain-name 1 2) b) :same-link(domain-name 2) c) :same-link(domain-name 2) d) :same-link(domain-name, scheme) e) :same-link(domain-name, port) f) :same-link(domain) g) :same-link(domain-name, user) ‘:local-link’ equals ‘:same-link(domain-name path)’. This proposal does not make it possible to include certain TLDs and exclude others. It’s also not thought through to the fullest extent.
Received on Wednesday, 15 February 2012 20:23:29 UTC