Closed
Bug 365721
Opened 19 years ago
Closed 19 years ago
style.display is NULL when declared in a css class
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: spazdaq, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
here is a stripped down example of my problem to recreate:
i have a style sheet that has the following declaration:
div.hidden_info { display:none; }
that style sheet is linked to an html page that has the following tags
<img src="expand.gif" onclick="testDisplayValue()">
<div id="some_tag" class="hidden_info">
some info
</div>
then i have a javascript function declared:
function testDisplayValue()
{
$x = document.getElementById('some_tag');
alert($x.style.display);
}
you will notice that even though the div loaded hidden as expected (declared in the css class)
the js dom value of style.display is null.
the problem does not happen if i declare the style display inline instead of in a class.
shouldnt the dom style values reflect the values of that tag as declared by the class assigned to that tag?
i figure this might be an optimization to save memory, but once i request a value from the style, i expect the class values to be copied into the style
object.
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1•19 years ago
|
||
Invalid. elem.style.foo is the inline style (e.g. <div style="display: none">), not the style that comes out of the application of all CSS rules and layout. Use getComputedStyle if you want the latter.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•