Bug 102198

Summary: CSS background-color does not map to bgColor attribute
Product: [Applications] konqueror Reporter: Mario Weilguni <mweilguni>
Component: khtml ecmaAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED NOT A BUG    
Severity: normal CC: browserbugs2
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Testcase for the report above

Description Mario Weilguni 2005-03-22 18:46:00 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

bgColor (and other attributes as well) are not correct in Javascript if the attribute comes from css. If the attribute is coded in html itself (i.e. <body bgcolor="#ff0000">) it works fine, with a stylesheet it fails:

This seems to be theoritcal, but there are quite some website that use this:
http://derstandard.at/?url=/?id=1990777

The left side contains an iframe with advertisements, and the background color of the iframe is taken from the parent. Since this does not work with stylesheets, the background will stay white.

I'll upload a testcase as well.
Comment 1 Mario Weilguni 2005-03-22 18:46:48 UTC
Created attachment 10278 [details]
Testcase for the report above
Comment 2 Tommi Tervo 2006-04-11 22:20:11 UTC
*** Bug 104384 has been marked as a duplicate of this bug. ***
Comment 3 Allan Sandfeld 2007-10-22 12:54:23 UTC
You can't set attributes from CSS. This is a case of mapped attributes.
Comment 4 Manuel Sanz 2008-04-20 03:42:26 UTC
Confirmed on 4.0.3. Accessing the DOM CSS properties does not seem to work either. After you set the style via DOM, the value is reported correctly.

Testcase:

<html>
<head>
<title>TEST BGCOLOR</title>
</head>
<style type="text/css">
body { background-color: #0000ff;  }
</style>
<body>
<script type="text/javascript">
alert("body.bgColor=" + document.body.style.backgroundColor);
document.body.style.backgroundColor = "#11ffff";
alert("body.bgColor=" + document.body.style.backgroundColor);
</script>

</body>
</html>
Comment 5 Maksim Orlovich 2008-04-20 04:09:34 UTC
Re: comment #4: That testcase is clearly invalid. You're not specifying it as inline information with element, so there is absolutely no reason for .style to report it. This info can only be gotten with getComputedStyle. 

The initial testcase is asking for returning the computed value in a DOM property. That's pretty unreasonable, IMHO.
Comment 6 GĂ©rard Talbot (no longer involved) 2012-01-23 04:48:18 UTC
(In reply to comment #3)
> You can't set attributes from CSS.

That's correct.

Testcase is invalid as explained.

Resolving as INVALID