Bug 102198 - CSS background-color does not map to bgColor attribute
Summary: CSS background-color does not map to bgColor attribute
Status: RESOLVED NOT A BUG
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 104384 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-03-22 18:46 UTC by Mario Weilguni
Modified: 2012-01-23 04:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Testcase for the report above (243 bytes, text/html)
2005-03-22 18:46 UTC, Mario Weilguni
Details

Note You need to log in before you can comment on or make changes to this bug.
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