Closed Bug 42417 Opened 20 years ago Closed 4 months ago

[meta] Supporting all CSS2 properties with getComputedStyle()


(Core :: DOM: CSS Object Model, defect, P5)






(Reporter: jst, Unassigned)


(Depends on 2 open bugs)


(4 keywords, Whiteboard: [Hixie-PF] [ngdriver/domcss])


(3 files)

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)
Target Milestone: --- → Future
Depends on: 47159
Adding that this bug depends on 63281
Depends on: 63281
Keywords: mozilla1.0
QA Contact: vidur → ian
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.
Assignee: jst → harishd
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
Keywords: dom2
Component: DOM Level 2 → DOM Style
Taking QA Contact on all open or unverified DOM Style bugs...
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.
Depends on: 73525
Nominating this bug for nsbeta1 on behalf of
Keywords: nsbeta1
Keywords: meta, testcase
Whiteboard: [Hixie-PF] [ngdriver/domcss]
Updating the dependencies.  See also bug 73525 for the issue of null vs. "" wrt 
the testcases...
Depends on: 84599, 94080, 94855, 95062, 97052, 98052
Summary: Supporting all CSS2 propeties with getComputedStyle() → Supporting all CSS2 properties with getComputedStyle()
Handing over getComputedStyle to bzbarsky. Thanks Boris.
Assignee: harishd → bzbarsky
Depends on: 101925
Depends on: 102678
Depends on: 106154
Depends on: 109523
Depends on: 116032, 116033
Blocks: 117500
Depends on: 125716
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.


<script type="text/javascript">
function bug()
  var view = document.defaultView;
  var span = document.getElementById('span');
  var style = view.getComputedStyle(span, null);

<body onload="bug()">
<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. ***
Depends on: 173354
Depends on: 77882
Keywords: helpwanted
Priority: P3 → P5
Depends on: 200497
Depends on: 200499
No plans to work on this any time in the foreseeable future, so to default owner.
Assignee: bz-vacation → general
Priority: P5 → --
Target Milestone: Future → ---
Depends on: 316981
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.
Assignee: general → nobody
QA Contact: ian → general
QA Contact: general → style-system

Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5

No activity for 15 years, closing

Closed: 4 months ago
Resolution: --- → FIXED
Summary: Supporting all CSS2 properties with getComputedStyle() → [meta] Supporting all CSS2 properties with getComputedStyle()
You need to log in before you can comment on or make changes to this bug.