Re: style.background rendering - browser inconsistency

This is symptomatic of the lack of any specific rules governing this  
in the CSS and DOM specifications.

CSS defines that the properties specified in the shorthand background  
property declaration can come in any order, and the DOM specification  
doesn't have any specific rules on what should be returned.

It does say that background first sets all other properties to their  
initial values, though the DOM spec doesn't state if these should be  
returned when accessing background.

I don't really think this is in the scope of the HTML WG to specify  
though.

http://www.w3.org/TR/REC-CSS2/colors.html#propdef-background
http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS- 
CSS2Properties-background

- Elliott Sprehn



On Apr 3, 2007, at 11:53 AM, David Dailey wrote:

>
> I'm not sure if this is an HTML problem or a CSS problem or an ECMA  
> script problem, so am not sure if it belongs in this discussion or  
> not.  I suppose it has to do with the orthogonality principle.
>
> Consider the following:
> <html>
> <body onload="document.getElementById 
> ('R').innerHTML=document.getElementById('Q').style.background">
> <div style="background:#afa" id="Q">Bonjour</div>
> <div id="R"></div>
> </body>
> </html>
>
> It doesn't matter if I use innerHTML or a DOM2 nodeValue approach  
> -- alert() shows the same discrepancy.
>
> The string returned by different browsers differs:
> IE -- #afa
> Firefox -- rgb(170, 255, 170) none repeat scroll 0% 0%
> Opera -- #aaffaa
>
> One can program around it, but it is a bit counterintuitive to me  
> that one gets three different answers.
>
> David Dailey
>

Received on Tuesday, 3 April 2007 19:02:49 UTC