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

[cssom] getComputedStyle and elements outside the tree

From: Anne van Kesteren <annevk@opera.com>
Date: Mon, 19 Apr 2010 15:52:13 +0900
To: www-style@w3.org
Message-ID: <op.vbeddblk64w2qv@annevk-t60>
For elements outside the tree that is being rendered on screen Opera and  
Chrome return the empty string for properties. Firefox however seems to  
apply style rules and return a computed style. I.e. marginTop gives "16px"  
for <p> elements. If you have style rules set for this element those are  
also taken into account it seems.

http://dump.testsuite.org/2009/getcomputedstyle/liveness/002.htm  
demonstrates this.

http://dump.testsuite.org/2009/getcomputedstyle/liveness/003.htm is a  
slightly more interesting demonstration where the element in question is  
coming from a different document (that also has style rules). Here Firefox  
applies the style rules from the document that is fetching the other  
document to the element from the document that is fetched. Opera throws  
because passing an element from a different document to getComputedStyle  
returns something weird and Chrome gives the empty string.

My question is whether this is a bug in Firefox or a feature I should  
somehow (how?) keep.


-- 
Anne van Kesteren
http://annevankesteren.nl/
Received on Monday, 19 April 2010 06:52:52 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:26 GMT