Re: Proposal: getStyleAs(property, primitiveValue)

On Sat, Sep 26, 2009 at 9:40 AM, Giovanni Campagna
<scampa.giovanni@gmail.com> wrote:
> 2009/9/25 Garrett Smith <dhtmlkitchen@gmail.com>:
>> On Fri, Sep 25, 2009 at 5:05 AM, Anne van Kesteren <annevk@opera.com> wrote:
>>> On Thu, 24 Sep 2009 20:45:51 +0200, Garrett Smith <dhtmlkitchen@gmail.com>
>>> wrote:
>>>>
>>>> document is a property of window. It has been that way for many years
>>>> before there was ever an AbstractView.
>>>>
>>>> AbstractView is relatively new, in contrast to nonstandard window and
>>>> its "document" property.
>>>
>>> Are you talking about implementations or specifications?
>>
>> Implementations.
>>
>> The global window property is much older, back into the 90's, before I
>> became involved in web development.
>>
>> As far as the DOM
>>> specifications are concerned AbstractView is relatively old and document is
>>> its sole member:
>>>
>>> http://www.w3.org/TR/DOM-Level-2-Views/views.html
>>>
>>
>> Still doesn't say that an AbstractView is window, though.
>>
>
> HTML5 says so, at <http://www.whatwg.org/html5#default-view>
> This means that everything that belongs to AbstractView or defaultView
> (such as getComputedStyle or document) is exposed on window, and by
> extension the ES global object.
> Any other behaviour is just a bug.

That would be true if HTML 5 were, as the author would like you to
believe, a web standard.

HTML5 is a draft that is being called a"Draft Standard".

Aside from that, there is still no good way to read the style of an
element, cross browser.

There should be a way to get:
* cascaded style
* computed, absolute style

style in arbitrary value would also be desirable. It is desirable for
interpolated values as in an animation that wants to be done in em
units, for example. The animation should not need to be done in px.
(red herring distractions about css animations are not relevant here).

Will MSIE 9 implement getComputedStyle?

If not, then another property or method is going to be important. Not
being able to read computed styles is a problem.

A solution that would cover all use-cases:

  style.getValueAs("width", "px")


Question: is that possible?

Garrett

Received on Tuesday, 22 December 2009 06:59:21 UTC