Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#7781 closed bug (duplicate)

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

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

Description

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 http://bugs.jquery.com/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 http://bugs.jquery.com/ticket/7393

here is my jsFiddle test case: http://jsfiddle.net/mpalmerlee/px2dW/

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.

Change History (2)

comment:1 Changed 8 years ago by jitter

Resolution: duplicate
Status: newclosed

comment:2 Changed 8 years ago by jitter

Duplicate of #7618.

Note: See TracTickets for help on using tickets.