- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Mon, 9 Mar 2015 14:56:04 -0700
- To: Jens Oliver Meiert <jens@meiert.com>
- Cc: Marat Tanalin <mtanalin@yandex.ru>, "L. David Baron" <dbaron@dbaron.org>, W3C WWW Style <www-style@w3.org>
On Mon, Mar 9, 2015 at 12:14 PM, Jens Oliver Meiert <jens@meiert.com> wrote: >> As an alternative selector syntax for your purpose, a function could be used >> instead of the attribute-selector syntax you've proposed: >> >> ::domain("example.com") .foo { >> /* Domain-specific styles for elements >> with the `foo` class. */ >> } >> >> But this does not seem to have serious advantages (other than just >> somewhat simpler syntax thanks to less braces) over an at-rule like >> `@document`: >> >> @document domain("example.com") { >> .foo { >> /* Domain-specific styles for elements >> with the `foo` class. */ >> } >> } > > I’d prefer ::domain over @document, but I’d wish we pushed harder for > simplicity. Hence, is that all as simple as we could get it? Why would > [host=] (or domain, document, or perhaps url) be so objectionable? What Marat said. Don't try to reuse existing syntaxes for incompatible things; it's just confusing for everyone. For the same reason, the pseudo-element approach is out, unless there's *actually some pseudo-element in the page that it corresponds to*. @-rules are how we introduce arbitrary new block-based syntax. Other than the exact characters used, there is literally no difference between "@document domain("foo") { h1 { color: red; } }" and "[host="foo"] h1 { color: red; }"; the two are expressing identical semantics, so there's no actual benefit in reaching for the one that misuses the syntax. ~TJ
Received on Monday, 9 March 2015 21:56:52 UTC