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

Re: [css-cascade-3] Potentially missing definitions and use case for reincluding "default value"

From: fantasai <fantasai.lists@inkedblade.net>
Date: Fri, 09 Aug 2013 14:40:08 -0700
Message-ID: <520561B8.9030902@inkedblade.net>
To: www-style@w3.org
On 08/09/2013 06:43 AM, Mike Sherov wrote:
> Apologies for coming in late on this discussion, and I'm not sure if this is covered in other specs, but there are a few
> definitons that I know of that are not defined in the Working Draft:
>
> 1. default value: this is the cascaded value if only the UA stylesheet is considered. The classic example is "display: block"
> for divs. This may not seem useful, but as a library contributor, jQuery sees authors who will specify a style sheet: "div {
> display: none; }" and then want to "show()" the div. In order for jQuery to know the display value for "showing" the div is
> "block", default value is needed (otherwise, jQuery adds an iframe to the page to and appends the div to the page in order to
> determine that it should be "block").

This situation is actually a bit more complicated than that.
If the author has set the element to some other display type
(such as 'flex' or 'inline-block'), then they want to revert
to that value, not to the UA default style sheet.

We're planning to solve this particular problem by splitting
out 'display: none' into a separate property from the display
type, so that you can toggle the "noneness" without affecting
the type. See Tab's draft here:
   http://dev.w3.org/csswg/css-display/

> 2. resolved value: that which is returned by getComputedStyle and is defined in CSSOM currently, but might belong here as well?

Yeah, it's probably worth mentioning this here, too, if only
informatively.

> Also, I'd like to make another(?) argument for the default keyword.
>
> 3. the "default" keyword: I know it was removed in favor of "unset". But if I understand correctly, "color:unset;" is
> equivalent to following javascript "element.style.color = ' ';". At least selfishly, I would really really love to be able to
> truly set the "default value" according to the definition I listed above.

Not exactly. 'unset' removes all declarations at all levels of
the cascade, so it's equivalent (for 'color') to 'inherit'.

To set it to what it would have been if only the UA style sheet
were present requires performing a cascade of just the UA style
sheet on the element as well as its ancestors, and then performing
inheritance. It's a fairly complicated feature. Worth contemplating,
but, I think, not high enough priority at the moment to work on,
given its complexity.

~fantasai
Received on Friday, 9 August 2013 21:40:35 UTC

This archive was generated by hypermail 2.3.1 : Friday, 9 August 2013 21:40:36 UTC