Re: What exactly is the replacement for getDefaultComputedStyle?

Also, getDefaultComputedStyle, at least for the jQuery use case, would not be unnecessary if there was a keyword "default" to go along with "initial" and "inherited" as values of css properties. 


In fact, you'd likely see higher usage out of "all: default" than "all: initial" specifically because things like "<input type=hidden>" and "<span>" would be set to "display: block". 




Note that, AFAICT, this problem doesn't go away with the CSS3 display module; Not as long as there is no css value keyword that takes into account element level differences, which initial does not. Even with CSS3 display, the initial value for "box" would still be "wrong" for "<input type=hidden>" and the "display-outside" would be "wrong" for "<span>". 




Apologies in advance if there is a spec that changes that behavior, but there wasn't AFAICT last time I checked. 
—
Sent from Mailbox

On Wed, Sep 3, 2014 at 7:15 AM, Mike Sherov <mike.sherov@gmail.com> wrote:

> From jQuery's perspective, we'd want both: getDefaultComputedStyle to handle userland code that causes is to currently use the iframe hack (and any other situation where we'd want to fallback to a browser default), and "box: none" for our ".hide()" and ".show()" methods, so that we don't need to resort to storing previous values when hiding. 
> —
> Sent from Mailbox
> On Wed, Sep  3, 2014 at 01:49 AM, Simon Pieters<simonp@opera.com>, wrote:
> On Tue, 02 Sep 2014 23:07:26 +0200, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>> At one point we agreed to add Element.getDefaultComputedStyle to CSSOM  
>> to address the "what is the default (user+ua) value for this element for  
>> a given CSS property?" use case.
>>
>> It looks like it's been removed from CSSOM at some point, but I see  
>> nothing replacing it.  Certainly none of the things on  
>> http://dev.w3.org/csswg/cssom/#getstyleutils cover this use case.  Am I  
>> just missing something?
>>
>> The lack of such an API is causing libraries like jQuery to rely on  
>> weird display:none iframe hacks in an attempt to gather this sort of  
>> information.  And even with those hacks, if user/UA stylesheets have  
>> media query dependent styles there's no way for them to get correct  
>> answers.
> http://lists.w3.org/Archives/Public/www-style/2013Aug/0161.html
> http://lists.w3.org/Archives/Public/www-style/2013Aug/0164.html
> https://dvcs.w3.org/hg/csswg/rev/3b8ded576b8a
> Is there interest in implementing box:none to satisfy the use case?
> -- 
> Simon Pieters
> Opera Software

Received on Wednesday, 3 September 2014 12:11:33 UTC