W3C home > Mailing lists > Public > www-style@w3.org > May 2013

Re: [css-regions] Changed @region rule to ::region() pseudo-element

From: Alan Stearns <stearns@adobe.com>
Date: Wed, 15 May 2013 10:30:13 -0700
To: Brad Kemper <brad.kemper@gmail.com>
CC: "www-style@w3.org" <www-style@w3.org>
Message-ID: <CDB9104D.2A4E3%stearns@adobe.com>
On 5/14/13 4:09 PM, "Brad Kemper" <brad.kemper@gmail.com> wrote:

>On May 14, 2013, at 10:52 AM, Alan Stearns <stearns@adobe.com> wrote:
>
>> On 5/13/13 8:55 PM, "Brad Kemper" <brad.kemper@gmail.com> wrote:
>> 
>>> On May 13, 2013, at 5:55 PM, Alan Stearns <stearns@adobe.com> wrote:
>>> 
>>>> Hey all,
>>>> 
>>>> Following the discussion in the earlier thread [1] about the
>>>> similarities
>>>> between region styling and the ::distributed() pseudo-element, I have
>>>> changed the @region rule to a ::region() functional pseudo-element.
>>>>Now
>>>> if
>>>> you want to use region styling to set the color of a fragment of an
>>>> element with 'class=bar' that displays inside a CSS Region with
>>>>'id=foo'
>>>> you can use:
>>>> 
>>>> #foo::region(.bar) {
>>>> color: red;
>>>> }
>>> 
>>> I actually greatly preferred the @region syntax, because it was easier
>>> for writing several rulesets for how styles should change within a
>>>single
>>> region. I think it was also much more readable than having the selector
>>> chains inside a pseudo-element of another selector chain.
>> 
>> I agree that the @region syntax was more compact for some cases. I think
>> it's arguable that separating the content selectors from the box
>>selector
>> made it more readable.
>
>Not to my mind. If it is a longish selector to select the region, and
>another longish selector to select the proper elements to change within
>that region, then one must write a very long selector with the
>pseudo-element approach, all on one line. And then one must write the
>first part again and again for each separate rule one wants to apply
>unique styling to within the region. It doesn't follow DRY principles.
>Whereas with the @rule, ones selects the region once, and then has
>simpler, shorter selectors for each ruleset being selected within the
>region. A little indenting within the style sheet, and one can clearly
>see which selectors are children of the region selector.

This is a problem with longish selectors outside of region styling (as
François mentioned[1]). I think the proper fix is to have some kind of
selector nesting mechanism that can be used anywhere.

> 
>
>>> I also thought @region was an improvement on the similar type of
>>>fragment
>>> child-element styling of @page. With @page, there are child rulesets
>>>only
>>> for margin boxes within the @page, and I always thought @page would
>>> benefit by being more like @region, allowing arbitrary selectors for
>>> anything appearing within that fragment. So, I am very disappointed to
>>> see the regions spec going away from the clear, easy to read and write
>>> syntax it had, instead of seeing other specs, like paged media, moving
>>> more towards the @region example. I'm not too familiar with
>>> ::distributed(), but it might have benefited from moving to an
>>> @distributed syntax instead too.
>> 
>> I suggested that, but the feedback I received in the earlier thread
>> weighed heavily towards the pseudo-element for both cases. I'm fairly
>> ambivalent about which syntax to use (both have advantages). The main
>> thing I want to avoid is two entirely separate mechanisms for combining
>>a
>> container selector with a content selector.
>
>But you have that by diverging farther from @page, don't you, in the
>sense that the margin box selectors are the contents, and @page is their
>container fragment? I know it's not exactly the same, but I think it
>would be simpler and cleaner to nudge @page towards the @region way of
>doing things, that to introduce a ::page() pseudo-element to be used for
>each element one wanted to have selected separately with within a
>particular page.

I had the @region rule in the draft with a number of issues, including one
asking to change to a pseudo-element. The majority of the feedback I've
gotten pushed me to make the change. One major point for me is that the
desired specificity of region styling is consistent with other
pseudo-element syntax. I also think that region styling is closer in
concept to ::distributed() than the current capabilities of @page.

Let's see what more people think now that I have ::region() in the draft.

Thanks,

Alan

[1] http://lists.w3.org/Archives/Public/www-style/2013Apr/0597.html
Received on Wednesday, 15 May 2013 17:31:29 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:30 UTC