per-site user stylesheet rules

I've implemented an at-rule allowing per-site user stylesheet rules in
Mozilla.  It's available in Mozilla 1.8 alpha 3.  This is based on the
idea proposed in [1], although with different syntax.

The syntax that I've implemented is the addition of an @-moz-document
rule that works like an @media rule and has the syntax (in some
reasonably typical notation):

docrule ::= "@-moz-document" S+ url-list "{" S* ruleset* "}"

url-list ::= url-item ( "," S* url-item )*

url-item ::= ( "url(" | "url-prefix(" | "domain(" ) URL ")" S*

where S is from the CSS2 tokenization, ruleset is from the CSS2 grammar,
and URL is like the production URI in the CSS2 tokenization except
without the 'url(' and ')'.

To define the three functions by example:

@-moz-document url(http://www.w3.org/),
               url-prefix(http://www.w3.org/Style/),
               domain(mozilla.org)
{
  /* CSS rules here apply to:
     + The page "http://www.w3.org/".
     + Any page whose URL begins with "http://www.w3.org/Style/"
     + Any page whose URL's host is "mozilla.org" or ends with
       ".mozilla.org"
   */
}

-David

[1] http://lists.w3.org/Archives/Public/www-style/2003Dec/0058.html

-- 
L. David Baron                                <URL: http://dbaron.org/ >

Received on Thursday, 19 August 2004 21:07:29 UTC