Bug Tracker

Opened 11 years ago

Closed 11 years ago

#12243 closed bug (fixed)

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

Reported by: [email protected] Owned by: mikesherov
Priority: low Milestone: None
Component: dimensions Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:


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

Change History (5)

comment:1 Changed 11 years ago by dmethvin

Component: unfileddimensions
Owner: set to mikesherov
Priority: undecidedlow
Status: newassigned

Mike, could you take a look at this?

comment:2 Changed 11 years ago by mikesherov

Of course I can!

comment:3 Changed 11 years ago by [email protected]

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.

comment:4 Changed 11 years ago by mikesherov

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.

comment:5 Changed 11 years ago by Mike Sherov

Resolution: fixed
Status: assignedclosed

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

Changeset: 670e3ff040b0a7164f36a3c5e07214420b8b09f4

Note: See TracTickets for help on using tickets.