getComputedStyle() is currently implemented in mozilla but so far only a very
small set of properties are computed and properly supported, this is a tracking
bug intended to track the implementation of the various CSS properties that can
be gequested from the computed style.
The currently implemented properties are:
left, top, right, bottom, width, hieght and display.
The DOM Level 2 CSS spec defines about 125 different properties but most of them
should be trivial to implement, and some are not supposed to be supported, like
"margin", in stead "margin-left", "margin-top", ... should be used.
The DOM Level 2 CSS spec is at
And the CSS2 spec is at
If you have spcial interest in some spcific property or a spcific set of
properties please file them as separate bugs and mark that this bug depends on
the new bug you file.
(the bug for getting getComputedStyle() into mozilla was bug 32169, and this bug
was split out from bug 39892)
Adding that this bug depends on 63281
I'd really like to see this bug fixed to work with all css properties. Is there
anything I can do that isn't C code to help with this one? I could create a
testcase for all of the properties, and file a bug for each, but I don't want to
flood bugzilla with them. Maybe a few large testcases/bugs for each category?
Let me know.
Dylan, you could write testecases for this, that would be greatly appreciated, a
HTML page that usess all the CSS2 styles on some elements and some JS that
checks that getComputedStyle() returns the right thing and document.write()'s
out the result would be great! (please use Netscape 6.01 to do this since
mozilla builds crash if you try to use getComputedStyle(), the crash is well
known and will be fixed)
Harish is currently working on this so I'm handing this bug over to him.
Created attachment 25350 [details]
testcase (all CSS2 properties for a block level element)
I posted a testcase which shows the computedStyle for all CSS2 properties which
are applicable for a block level element. I will do the same for the other
display types as time permits. All styles are default. It may be more
appropriate to apply this type of testcase to a css test suite, with styles that
test proper cascading and inheritance
Taking QA Contact on all open or unverified DOM Style bugs...
Created attachment 26823 [details]
testcase (all block level elements, replaced null with "" per notes in bug 63281)
Created attachment 26828 [details]
testcase (correction: all block level elements, replaced null with "" per notes in bug 63281)
Note that color and background-color are now returning values with px units,
which is incorrect. padding and border widths are now returning correct values
in the 2001030505 build.
Nominating this bug for nsbeta1 on behalf of email@example.com.
Updating the dependencies. See also bug 73525 for the issue of null vs. "" wrt
Handing over getComputedStyle to bzbarsky. Thanks Boris.
At least in the following example getComputedStyle returns "auto" for the "left"
property. It should return the actual pixel value. I'm using nightly build
2002041521 and IIRC this has worked in previous builds.
var view = document.defaultView;
var span = document.getElementById('span');
var style = view.getComputedStyle(span, null);
<p>text <span id="span">span</span> text</p>
> It should return the actual pixel value.
It should absolutely not, since the element is not positioned and thus the
"left" property does not apply. See bug 109523.
Furthermore, this is a tracking bug.... please raise issues with computed style
in new bugs that you file that block this one.
*** Bug 160619 has been marked as a duplicate of this bug. ***
No plans to work on this any time in the foreseeable future, so to default owner.
This bug depends on 317340, but I do not have sufficient privilege to add it to the depends list.
I have included a sample HTML file that demonstrates this problem.
getPropertyValue is broken for CSS2.