Re: Domain selectors

On Saturday 2015-03-07 20:46 +0100, Jens Oliver Meiert wrote:
> Quick and dirty.
> 
> I grow fond of the utility of something like a domain (more precisely:
> hostname) selector:
> 
>   [host='example.com'] html { color: red }
> 
> The syntax would follow that of attribute selectors (as well as RFC 3986).
> 
> The only constraint would be that the domain selector would need to be
> followed by another selector (as with “html” in example).
> 
> The use cases:
> 
> 1) More effective—or rather finally manageable—handling of
> multi-domain/subdomain sites (as with easier “skinning”).
> 
> 2) More robust user style sheets (as in reasonably limiting the scope
> of possibly overly aggressive selectors).
> 
> I’m not aware of any existing work here and, glossing over the idea,
> it seems to be of value.

There was a draft in earlier versions of CSS Conditional Rules:
http://www.w3.org/TR/2012/WD-css3-conditional-20120911/#at-document
and it's been implemented in Gecko as @-moz-document for a long
time.

The main reasons for dropping it were that (1) it wasn't clear what
definition of URL equality to specify and (2) there wasn't much
interest from other browsers in implementing it.

There were also some security concerns related to sites that allowed
others to provide CSS to be included on their site without doing
proper sanitization; see
https://bugzilla.mozilla.org/show_bug.cgi?id=1035091

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Received on Saturday, 7 March 2015 20:11:19 UTC