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

Re: [css-gcpm] String-set issues

From: Brad Kemper <brad.kemper@gmail.com>
Date: Mon, 24 Nov 2014 06:19:56 -0800
Cc: www-style list <www-style@w3.org>, Dave Cramer <Dave.Cramer@hbgusa.com>
Message-Id: <6A644036-E738-48B6-87D9-28CE2DFE4F35@gmail.com>
To: François REMY <francois.remy.dev@outlook.com>
On Nov 23, 2014, at 3:44 AM, François REMY <francois.remy.dev@outlook.com> wrote:

>>> On Nov 22, 2014, at 1:37 PM, François REMY <francois.remy.dev@outlook.com> wrote:
>>> 
>>> ± By default, the content fragment name would be global, as the named 
>>> flow is ± with 'flow-into'. But if one of the following pseudo-classes 
>>> are used on the ± subject of the selector, then the name is locally 
>>> scoped to just the page the ± element is on.
>>> ± 
>>> ± :nth-of-page(n)    The element is the nth matched element on the page.
>>> ± :first-of-page       Same as :nth-of-page(n), but where n = 1 (it is the first
>>> ± matched element on the page).
>>> ± :last-of-page       The element is the last matched element on the page.
>>> ± :start-of-page      The element is the first matched element on the page, and
>>> ± neither it nor its ancestors have any previous siblings that appear 
>>> on the ± page.
>>> 
>>> This doesn't seem to be a possible solution to me. The effect of a property can't depend on the selector which applied it, as far as I know.
>> 
>> Can you say why not, specifically? 
>> 
>> It is not so much about the selector as what is selected. 
>> There are many properties that have different effects on replaced
>> content, like images, than on other things, so those are cases 
>> where the effect of the property depends on what is selected. 
>> 
>> And even :hover causes the properties to act differently than
>> they do if the element is selected normally. If :hover can mean
>> "don't apply the effects if the cursor isn't over element", then
>> I don't know why :first-of-page cannot mean "don't apply to the
>> global name, but apply to a page-local name only".
> 
> There's some misunderstanding here. A property can have a different impact depending on what it is applied on, no doubt about that.

Right. So being applied to 'h2:first-of-page' can have a different impact than being applied to 'h2'.

> What it can't be is have a different behavior depending on the selector.  

Depends on how you define "behavior". 

> Your "#element:hover" example doesn't show a counter-example of that; if you do ":hover { color: red }" you didn't change the meaning of the "color" property,

I did if 'color:green' means "make this element always green". But that is not what 'color:green' means, since the element's state can change it. Likewise, 'copy-into: myFlow' doesn't mean "put the contents into a flow whose name is always globally scoped", since the element's state can change it.

> you just changed its value when the element is matching ":hover". If you removed ":hover", you would get the same result as if the element did always match ":hover" even when it's not, that's al.

In other words, removing a rule removes the effect of the rule. This isn't an argument against what I proposed. 

> The process of CSS Cascading is to :
> - find all enabled rules matching an element, 
> - collect all the valid declarations of said rules, 
> - sort them by (has("!important"), parent stylesheet priority, parent rule priority), then 
> - for any property, find the first declaration which set the property, and map the property to its value. 
> 
> The result of this is then set as the cascaded style of the element. If a change in the document can potentially affect which rules are matched by an element, the process is started again (let's forget optimizations here), including the the set ":hover"ed elements is changed. There's nothing special about ":hover", you can imagine this as being a simple "hover" class you would add to the element onmouseenter and remove onmouseleave.

Yes, except for specificity. 

You aren't proving anything here. You can imagine ':first-of-page' as being a simple "first-of-page" class that is added to the element when it is in a certain position of the page. That doesn't mean I can't define 'copy-into' to have different effects based on that.

Consider this codepen:

http://codepen.io/anon/pen/ZYGzYX

There, I am changing the behavior of "height" and of "vertical-align" based on rules defined in a ':hover' rule.

> As a consequence of this, the value of a property should encode its action, you cannot rely on the selector as the selector is only reduced to its priority well before the actual style is interpreted by the browser.

The value of 'copy-into', as I've described it, does encode its action; its just that the action is different based on the type of thing that is selected, and the type of thing that is selected is influenced by pseudo-class. I've just shown that I can rely on a pseudo-class to changing how properties work. The pseudo-class indicates a change the nature of the element selected, as though it was a different kind of element with different effects on some property values. It doesn't matter that the selecting phase came earlier. It isn't about selecting, it is about a different (pseudo-)class of element having different effects.
Received on Monday, 24 November 2014 14:20:29 UTC

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