W3C home > Mailing lists > Public > www-style@w3.org > March 2015

Re: Domain selectors

From: Marat Tanalin <mtanalin@yandex.ru>
Date: Mon, 09 Mar 2015 01:28:50 +0300
To: Jens Oliver Meiert <jens@meiert.com>, L. David Baron <dbaron@dbaron.org>
Cc: W3C WWW Style <www-style@w3.org>
Message-Id: <7250451425853730@web5g.yandex.ru>
09.03.2015, 01:02, "Jens Oliver Meiert" <jens@meiert.com>:
> @document doesn’t seem to be
> much of an advantage over just using a separate style sheet, an option
> always at our disposal, whereas [host=], as a selector, would allow
> for easy, DRY domain-specific adjustments.

`[host="example.com"]` selects elements that have `host` attribute with `example.com` as its value.

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. */

Possible drawbacks of the `@document` at-rule in its current form are:

    * `@document domain("example.com")` selects not just `example.com`,
      but also its subdomains like `bar.example.com`. There should
      probably a way to select exact domains, e.g. `example.com` only,
      without its subdomains;

    * there is the `regexp()` function that may be considered
      "too complicated" or "too slow" by some people (not really an issue,
      but could easily be postponed to a next spec level).

Some people also mention some security issues, but it's unclear what exact issues they mean.
Received on Sunday, 8 March 2015 22:29:51 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:52 UTC