getComputedStyle() width property broken for table element, always returns width of parent

RESOLVED WORKSFORME

Status

()

Core
DOM: CSS Object Model
RESOLVED WORKSFORME
11 years ago
7 years ago

People

(Reporter: Jonathan Leech, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b2) Gecko/2007121120 Firefox/3.0b2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b2) Gecko/2007121120 Firefox/3.0b2

See example below.
<html>
   <body>
      <div style="width:400px">
         <table style="width:200px; border:2px solid black">
            <thead>
               <tr>
                  <td>One</td>
                  <td>Two</td>
                  <td>Three</td>
               </tr>
            </thead>
            <tbody>
               <tr>
                  <td>One</td>
                  <td>Two</td>
                  <td>Three</td>
               </tr>
            </tbody>
         </table>
      </div>
   </body>
   <script>
      alert(getComputedStyle(document.getElementsByTagName("table")[0],'').getPropertyValue('width'));
   </script>
</html>

Reproducible: Always

Steps to Reproduce:
1. View the example in a browser


Actual Results:  
400 px

Expected Results:  
200 px

This worked in previous Firefox versions.
Doesn't matter if the table width is auto, a specific pixel width, a percentage, etc.

Comment 1

11 years ago
Could you upload the testcase using "Add an attachment", thanks.
(Reporter)

Comment 2

11 years ago
Created attachment 294088 [details]
test case
QA Contact: general → style-system
The testcase alerts "196px" for me, which looks correct.  Presumably fixed when we started using the inner table for a bunch of the computed style stuff...
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.