Ticket #7782 (closed bug: invalid)
Cannot get width of table column in Chrome
| Reported by: | anonymous | Owned by: | anonymous |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | dimensions | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Using Chrome 8, selecting a table column
<col />
and running
.width()on it will just return 0. But using straight javascript
parseInt(el.style.width)will get the width just fine.
This seems to work just fine in Firefox 3.6 and the IE9 beta. Chrome 8 will just return 0 for some reason.
I've put together a test case here: http://jsfiddle.net/r74JT/
Change History
comment:1 follow-up: ↓ 2 Changed 2 years ago by jitter
- Owner set to anonymous
- Status changed from new to pending
comment:2 in reply to: ↑ 1 Changed 2 years ago by c.barr
Replying to jitter:
And how is this a jQuery bug? If you inspect the col elements in Chrome it shows 0 as computed value. Using el.style.width just returns the css rule value.
test case with non px-value set as width.
Oh sorry, I guess you're right. This is more of a Chrome bug since the computed width is incorrect. I didn't check there. Also, there was an update to Chrome 8 tonight and the problem still exists.
Although, in the same vein, shouldn't .css() return the correct value? Does that just return the style or does it return the actual computer width? I updated the example to include this as well: http://jsfiddle.net/r74JT/3/
comment:3 Changed 2 years ago by jitter
.css() returns the computed width (which in Chrome is 0px). May I suggest that you use .width() on the actual column instead of calling it on the "col" element. Or what is the use case for calling this on "col"
comment:4 Changed 2 years ago by trac-o-bot
- Status changed from pending to closed
- Resolution set to invalid
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

And how is this a jQuery bug? If you inspect the col elements in Chrome it shows 0 as computed value. Using el.style.width just returns the css rule value.
test case with non px-value set as width.