Skip to main content

Bug Tracker

Side navigation

#12243 closed bug (fixed)

Opened August 10, 2012 12:03PM UTC

Closed August 29, 2012 04:42PM UTC

$("col").width() returns 0

Reported by: akorchev@gmail.com Owned by: mikesherov
Priority: low Milestone: None
Component: dimensions Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:
Description

It seems that width(), outerWidth() and css("width") no longer work for col elements. Zero is always returned. Here is the repro: http://jsbin.com/ilejan/1/edit

Attachments (0)
Change History (5)

Changed August 21, 2012 01:27AM UTC by dmethvin comment:1

component: unfileddimensions
owner: → mikesherov
priority: undecidedlow
status: newassigned

Mike, could you take a look at this?

Changed August 21, 2012 01:41AM UTC by mikesherov comment:2

Of course I can!

Changed August 29, 2012 09:25AM UTC by nicola@xbblabs.com comment:3

I have a similar issue:

http://jsfiddle.net/eZLLU/

If you remove the div tag or if you use jQuery 1.7.2, width is reported correctly.

Changed August 29, 2012 12:06PM UTC by mikesherov comment:4

nicola: http://stackoverflow.com/questions/1827965/is-putting-a-div-inside-an-anchor-ever-correct While jQuery worked in this case in 1.7.2, it was accidental. It worked because jQuery was changing the style of the a tag to display: block momentarily. This causes undesired and incorrect results elsewhere. Removing the div makes it work again, because you once again have valid HTML.

Long story short: use valid HTML and it works fine.

Fix for col coming shortly.

Changed August 29, 2012 04:42PM UTC by Mike Sherov comment:5

resolution: → fixed
status: assignedclosed

Fix #12243, $("col").width() should return the column's width. Close gh-916.

Changeset: 670e3ff040b0a7164f36a3c5e07214420b8b09f4