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.
Created attachment 10278 [details] Testcase for the report above
*** Bug 104384 has been marked as a duplicate of this bug. ***
You can't set attributes from CSS. This is a case of mapped attributes.
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>
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.
(In reply to comment #3) > You can't set attributes from CSS. That's correct. Testcase is invalid as explained. Resolving as INVALID