Skip to main content

Bug Tracker

Side navigation

#7781 closed bug (duplicate)

Opened December 14, 2010 08:41PM UTC

Closed December 14, 2010 11:51PM UTC

Last modified December 14, 2010 11:51PM UTC

width() returns 100 for 100% width display:none elements in Firefox

Reported by: Owned by:
Priority: undecided Milestone: 1.6
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

As of jQuery 1.4.4 my display:none elements with width 100% no longer return 0 from calls to width(), instead width() returns 100 which is incorrectly interpreted as 100 pixels instead of 100%. In jQuery 1.4.3 width for this display:none element returns 0 as expected.

It appears that this issue was introduced after a fix for Ticket:7225

In Firefox (3.6.13) on the following lines:

var orig = jQuery.css( elem, type ),

ret = parseFloat( orig );

orig gets the value 100% back from css() and subsequently parseFloat then returns 100, on IE (version 8) the same code

orig gets the actual size of the element back from css() which is ok (but not consistent with older versions where IE would also return 0 for hidden elements).

This issue may also be related to Ticket:7393

here is my jsFiddle test case:

This was tested on and doesn't work on Firefox 3.6.13 and Chrome 8.0.552.215, in IE 8 the result is ok.

Attachments (0)
Change History (2)

Changed December 14, 2010 11:51PM UTC by jitter comment:1

resolution: → duplicate
status: newclosed

Changed December 14, 2010 11:51PM UTC by jitter comment:2

Duplicate of #7618.