- From: Simon Pieters <simonp@opera.com>
- Date: Mon, 12 Aug 2013 10:35:01 +0200
- To: fantasai <fantasai.lists@inkedblade.net>, "Mike Sherov" <mike.sherov@gmail.com>
- Cc: "www-style@w3.org" <www-style@w3.org>
On Sat, 10 Aug 2013 17:01:10 +0200, Mike Sherov <mike.sherov@gmail.com>
wrote:
>>> 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.
>
> Correct. Not that it matters much, but jQuery handles that case fine
> already. We're only forced to do the iframe hack when the element has
> display of "none".
>
>>
>> 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/
>
> This is awesome! What can I do to help move this draft along and get
> it implemented.
> Yeah, I suppose at the moment I really only have a use case for
> "default value" for "display". My concern here was only isn't that
> we're special case fixing the display problem. It might be YAGNI, but
> default value, while difficult, provides a general answer and low
> level solution to that type of problem.
So we added defaultStyle to CSSOM because of the above-mentioned iframe
hack in jQuery.
http://lists.w3.org/Archives/Public/www-style/2013Apr/0568.html
If toggling 'display' is the only use case, and 'box:none' addresses that
use case better than .defaultStyle, should we drop .defaultStyle from
CSSOM?
--
Simon Pieters
Opera Software
Received on Monday, 12 August 2013 08:30:09 UTC