Re: [Proposal] A property selector

On Sun, Jul 27, 2014 at 4:18 AM, Peter Moulder
<pjrm@mail.internode.on.net> wrote:
> 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.

Yeah, given the semi-persistent interest in a value that means
"whatever the UA stylesheet would do" or "whatever the UA and user
stylesheets would do", it might be okay to go up one more level and
have something that's only valid in user-important rules that can
detect "whatever all the lower-origin stylesheets would do".

I don't think we particularly need this for author-level stylesheets, though.

~TJ

Received on Sunday, 27 July 2014 19:32:27 UTC