W3C home > Mailing lists > Public > www-style@w3.org > April 2007

Re: Returning null from ViewCSS.getComputedStyle()

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Mon, 23 Apr 2007 08:00:52 +0200
To: Cameron McCormack <cam@mcc.id.au>
Cc: www-style@w3.org
Message-ID: <6oio23hsl4q075pjiag2vjqc7e5lj2midg@hive.bjoern.hoehrmann.de>

* Cameron McCormack wrote:
>Is it conforming behaviour for a UA to return null from the call to
>ViewCSS.getComputedStyle() if the element is not something that renders?
>For example:
>
>  <svg xmlns='http://www.w3.org/2000/svg'>
>    <abc xmlns='http://example.org/' id='a'/>
>    <script>
>      a = document.getElementById('a');
>      s = document.defaultView.getComputedStyle(a, null);
>
>      // Is s allowed to be null?
>    </script>
>  </svg>
>
>SVG states that subtrees rooted in elements, such as the ‘abc’ element
>above, are never rendered.  Currently, Batik[1] will return null for any
>element that does not derive from SVGStylable, but I’m wondering if that
>behaviour is correct.

Well if the specification is not very clear about that, it will take a
new edition of the Recommendation to give an authoriative answer, but
while returning `null` for Element objects not in the document is quite
sensible, I don't think that is the case for elements in the document.
In the CSS model, there is a computed value for each property on all
elements in the document, and you should be able to query it using this
method.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Monday, 23 April 2007 06:01:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:50 GMT