Bug Tracker

Modify

Ticket #7781 (closed bug: duplicate)

Opened 3 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 3 years ago by jitter

  • Status changed from new to closed
  • Resolution set to duplicate

comment:2 Changed 3 years ago by jitter

Duplicate of #7618.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.