Bug Tracker

Modify

Ticket #4869 (closed bug: worksforme)

Opened 4 years ago

Last modified 14 months ago

ie & Firefox: setting a div's width to its own current width will cause text content to wrap

Reported by: patrickwhalen Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: firefox width text wrap Cc:
Blocking: Blocked by:

Description

  1. Create a div that is floated left (or has some other css attribute that will cause its width to reduce to its content).
  1. Place a sentence of text inside the div.
  1. Get the div's width. var theWidth = $('#myDiv').width();
  1. Set the div's width to the value retrieved in step 3. $('#myDiv).css({width: theWidth});

Firefox result: Even though the width of the div hasn't changed, the text will wrap as though the div has been reduced in width. Tested Firefox 3 and 3.5 on mac os x.

ie result: The width of the div reduces each time by the size of the left and right borders. As though when getting the width, it subtracts out the border, so that when setting the width with that size, it is actually reducing it by the amount that was subtracted out. Tested ie 7 & 8 on xp.

webkit and opera are not affected.

Attachments

width_anomalies.html Download (1.7 KB) - added by patrickwhalen 4 years ago.

Change History

Changed 4 years ago by patrickwhalen

comment:1 Changed 3 years ago by dmethvin

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

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.