Re: [css3] URI selectors

On 12/8/03 12:50 PM, "Boris Zbarsky" <bzbarsky@MIT.EDU> wrote:

> 
> Chris Moschini wrote:
>> For this reason, why not offer as part of the CSS3 spec a selector that can
>> differentiate
>> between URIs? Something like:
>> 
>> uri( "www.w3c.org" ), url( "www.w3.org" ) { font-size: 150%; }
>> 
>> It could be a huge boon to accessibility.
> 
> It would be much easier for the UA to implement per-site user
> stylesheets...  The UA can then even use a definition of "site" that's
> somewhat better than a direct URI match (eg based on document.domain
> amongst other things).

It is doubtful that the UA will understand what defines the "site" better
than the author of the site.

Thus an author technology is preferable to a UA-only technology.

In addition, any such author technology can be overridden by the user in
their user style sheet, or by UA settings which result in synthesized user
style sheet rules.

This kind of functionality was previously proposed, albeit using an at-rule
(which I think is preferable to a selector -- as selectors *should* be
limited to aspects of elements rather than aspects of the document (like its
URL), viewport, media etc.)

Todd Fahrner proposed @scope in 1999.  It works like @media except based on
the URL rather than the media type.

[CSS WG only link]
 http://lists.w3.org/Archives/Member/w3c-css-wg/1999JanMar/0274.html

Here are the essential bits (I don't think Todd won't mind that I reposted
this).  I still think this is a good proposal, and think it may find its way
to either the CSS3 Cascading or CSS3 Syntax modules (more likely Cascading).

Tantek



==================
From: Todd Fahrner
Date: Wed, 10 Mar 1999 09:11:00 -0800


How about an "@scope" feature to limit application of the enclosed rules to
the specified scope? e.g.:

@scope url("http://www.apple.com/")
    {
    background: red;
    }

@scope url("http://www.ibm.com/")
    {
    background: blue;
    }

Now these rules would apply to all subdirectories inside those urls as well.

You should also be able to do stuff like this:

@scope url("/ads/"), url("http://www.yahoo.com/ad1.jpg")
    {
    display: none;
    }

or this:

@scope url("http://intranet.mycompany.com/")
    {
    background: no-repeat fixed url("confidential.png");
    }

or this:

@scope url("https:")
    {
    background: no-repeat fixed url("securehttp.png");
    }

or this:

@scope url("file:")
    {
    background: no-repeat fixed url("local.png");
    }

Obviously useful for user style sheets, as it suggests a CSS framework for
UAs to apply certain rules only to certain domains, whose authors may have
some disagreeable notions of taste or usability. With some sort of
expression for "the current domain", would enable transient application of
bits of corrective or "utility" CSS.

...

===============

Received on Monday, 8 December 2003 21:40:27 UTC