Re: [css21] undo style declarations / cascading

|  Let's assume that 'default' has the same principle of applicability as 
e.g.
|  'thin' value in lengths.
|
|  Did I miss something in principle?

Maybe. It's possible that you did miss the fact that

    <img src="ecss.png" width="32" height="32" style="width: auto; height: 
auto;" />
    <img src="ecss.png" width="32" height="32" /> && img { width: auto; 
height: auto;" }
    where ecss.png is a 400*400 image

produces two 400px*400px images.



The reason why the width attribute is actually taken in consideration in the 
"normal" case is quite subtle and not really well defined in CSS. You can 
view the "width:32px;height:32px" declaration either as coming from the UA 
stylesheet (but it has more importance than most other UA styles) or from 
the bottom of the author style (and it has a lower importance than anything 
else).

That's for the theory. From now I'm less certain but if I understand 
correctly the "default keyword", if you "default" at the author level the 
"width" declaration, you stop to apply any author-defined rule. If you said 
that the attributes are author-defined so they belong to the bottom of the 
author level, they get discarded. However, if you said that they were 
applied (using some custom attr() syntax) at the top of the user agent 
stylesheet, they'll take the lead and work properly.



I'm unaware of any precise decision about the location (=origin) where 
attributes styling lays in the style stack so I don't know what is the 
specced outcome. However, I believe we should say that those rules belong to 
the "UA stylesheet" because they are not explicitely defined by the author. 
That means the UA stylesheet would contain a declaration like:

    img[width] { width: attr(width px); }
    img[width$="px"], img[width$="em"], img[width$="%"], img[width$="vw"], 
... { width: attr(width length); }

In this case, the "default" keyword would work as expected. However, given 
Tab's reflexion, I suppose Webkit choose the "lowest author declaration" 
kind of rule. 

Received on Friday, 9 November 2012 13:27:31 UTC