W3C home > Mailing lists > Public > www-style@w3.org > May 2004

Re: getComputedStyl, ViewCSS (and Safari)

From: David Hyatt <hyatt@apple.com>
Date: Tue, 25 May 2004 14:53:55 -0700
Message-Id: <04EEBE5A-AE96-11D8-9E1B-000A958E6110@apple.com>
Cc: www-style@w3.org
To: Gavin Kistner <gavin@refinery.com>

There is no way to get the computed style of an element in Safari 1.2.   
getComputedStyle is stubbed but not implemented.  Future versions will  
at least partially support getComputedStyle.

dave

On May 25, 2004, at 2:46 PM, Gavin Kistner wrote:

>
> According to the DOM 2 CSS specs, the ViewCSS class (which inherits  
> from DOM2Views::AbstractView) has an instance method  
> "getComputedStyle()". [1] I'm writing a function [2] in JS to get the  
> current style of an element in a cross-browser manner. It works for  
> IEWin and Mozilla, but not Safari (v1.2). Some questions:
>
> * From the DOM 2 CSS specs, I see that the DOM2Views::DocumentView  
> class has a defaultView property which points to an AbstractView  
> instance. Mozilla uses document.defaultView to refer to the ViewCSS  
> instance for getComputedStyle(), but in Safari 'document.defaultView'  
> is a function that returns an AbstractView instance. Is Safari  
> definitely wrong in this case?
>
> * What is the second parameter ('pseudoElt') in getComputedStyle for?  
> (The documentation for it [3] is really vague, saying only that it's a  
> DOMString and describing it as "The pseudo-element or null if none.")
>
> * Using document.defaultView().getComputedStyle(myEl,null) always  
> returns null in Safari, even for elements with explicit styling on  
> them [4]. Does anyone know if Safari is simply broken in this regards,  
> or if there's a way to get the computed style for an element?
>
> Thanks in advance for any answers you can help me out with.
>
> --
> (-, /\ \/ / /\/
>
> [1] http://phrogz.net/ObjJob/object.asp?id=250
> [2] http://phrogz.net/JS/CurrentStyle_js.txt
> [3]  
> http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS- 
> CSSview-getComputedStyle
> [4] http://phrogz.net/tmp/currentstyle.html
>
Received on Tuesday, 25 May 2004 17:54:33 GMT

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