[cssom] getComputedStyle and elements outside the tree

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.

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

Received on Monday, 19 April 2010 06:52:52 UTC