Re: [cssom] Proposal for obtaining robust style information via Javascript - getStyle()

On Tue, May 7, 2013 at 2:26 PM, Simon Pieters <simonp@opera.com> wrote:
> On Tue, 07 May 2013 18:47:20 +0200, Tab Atkins Jr. <jackalmage@gmail.com>
> wrote:
>> On Tue, May 7, 2013 at 8:33 AM, Simon Pieters <simonp@opera.com> wrote:
>>>
>>> The spec currently has getComputedStyle which returns "resolved value"
>>> which
>>> can be computed style or used style.
>>>
>>> Recently I added a method getDefaultComputedStyle which returns the
>>> computed
>>> value but ignores author CSS.
>>>
>>> The use case presented above asks for specified style. Are there use
>>> cases
>>> for the other kinds of values? Would cascaded value instead of specified
>>> value be better (i.e. return 'initial', 'inherit' and 'default' instead
>>> of
>>> specified value)?
>>
>>
>> There's definitely use-cases for always getting used styles, due to
>> them being "close enough" to the final values used in rendering.  For
>> example, see the Grid spec, which is currently trying to specify that
>> getComputedStyle() must return used values for its grid-definition-*
>> properties.
>
>
> Thanks. However, the grid spec doesn't state use cases for getting used
> value, as far as I can tell. If it is documented somewhere else, please give
> a pointer.

The use-case is figuring out how wide your tracks actually ended up,
after the grid layout algorithm was run, so you can, for example,
position abspos things around it, size canvases, etc.

> That sounds reasonable, but I still want use cases stated for everything new
> introduced so we don't end up specifying and implementing things that don't
> get used.

Well, people currently get value out of getComputedStyle(), and it
only returns used styles for a handful of properties, returning
computed for everything else, including those that are roughly similar
to the legacy-used-value properties.  That suggests that computed
values are valuable to authors.  If we're going to introduce some new
getters in the style that dbaron suggests, it would be worthwhile to
have computed styles align with that.

~TJ

Received on Tuesday, 7 May 2013 21:57:44 UTC