W3C home > Mailing lists > Public > www-style@w3.org > July 2014

Re: [Proposal] A property selector

From: Peter Moulder <pjrm@mail.internode.on.net>
Date: Sun, 27 Jul 2014 21:18:30 +1000
To: www-style list <www-style@w3.org>
Cc: MichaŽl Rouges <michael.rouges@gmail.com>, "Tab Atkins Jr." <jackalmage@gmail.com>
Message-ID: <20140727111830.GA28761@mail.internode.on.net>
On Wed, Jul 23, 2014 at 11:20:37AM -0700, Tab Atkins Jr. wrote:
> On Wed, Jul 23, 2014 at 10:49 AM, MichaŽl Rouges
> <michael.rouges@gmail.com> wrote:

> > The goal is to have a selector that matches on CSS properties (or property
> > values).
> >
> > It usefull to make custom stylesheets (like one by user, overloading a
> > default stylesheet)
> 
> Unfortunately, this isn't possible to do.  It suffers from basic
> circularity problems.

Adding another possible resolution to those that Tab has already sketched:

Suffering from circularity problems just means there needs to be a way to
break or avoid a cycle.  E.g. instead of selecting based on the final value,
it might select based only on the value that would result considering only
declarations that are strictly earlier in some ordering consistent with what
CSS 2.1 calls cascading order
(http://www.w3.org/TR/CSS21/cascade.html#cascading-order, which
http://dev.w3.org/csswg/css-cascade/#cascading renames to precedence,
if I correctly understand the two documents).

E.g. a fairly minimal such ordering would be that this selector can only be
used in !important declarations, and it would select based on the property
values that result from non-!important declarations.  Another such ordering
would be that it selects based on the property values that result from
declarations with a less important <!important-ness, origin> value pair
("origin and importance" subheading in css-cascade).

A simplistic implementation would process declarations in an order consistent
with the chosen ordering [I believe that some UAs already do this part, at
least for the two example orderings given above], and remember for each
property the most recent value that resulted from a strictly earlier value of
the chosen ordering.

I think the above can work well for the "user stylesheet to modify a site
stylesheet" use case (largely avoiding the need for the user to start by
reading the site's stylesheet to work out what selectors to override), so
would be welcomed by those 0.0001% of web users (and 30% of readers of this
mailing list) who actually use user stylesheets as such; but I can't comment
on the scripting use case that the original poster considers to be the
primary value of property-value selectors.

pjrm.
Received on Sunday, 27 July 2014 11:19:02 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:23 UTC