Closed
Bug 271991
Opened 20 years ago
Closed 20 years ago
Style attributes are not accessible from JavaScript functions
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: mozilla-bugs, Assigned: bugzilla)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20041001 Firefox/0.10.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20041001 Firefox/0.10.1
Style attributes which are defined in a <style> section or in an external
<link>ed file are not accessible from JavaScript. Only inline defined style
attributes can be accessed.
Reproducible: Always
Steps to Reproduce:
<html>
<head>
<style type="text/css">
div {
background-color: #ddd;
}
</style>
</head>
<body>
<div onclick="alert(this.style.backgroundColor);">muh</div>
</body>
</html>
Actual Results:
The popup window is empty.
Expected Results:
The string "#ddd" or an equivalent to be displayed in the popup window.
Changing the line
<div onclick="alert(this.style.backgroundColor);">muh</div>
to
<div style="background-color: #ddd;"
onclick="alert(this.style.backgroundColor);">muh</div>
fixes the behaviour.
Anyway, I still consider this a bug. IE shows the same beaviour so I really hope
it is in fact a bug and not a feature. :P
I can test this under Linux later, but I don't expect to see it work there.Same effect for Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20041001 Firefox/0.10.1
Comment 2•20 years ago
|
||
Could be related to bug 111943.
Please see: http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-ElementCSSInlineStyle INVALID
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•