RE: [css-gcpm] String-set issues

>> 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.

What it can't be is have a different behavior depending on the selector.  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, 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.

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.

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.

Received on Sunday, 23 November 2014 11:45:18 UTC