Bug Tracker

Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#4869 closed bug (worksforme)

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

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 (1)

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

Download all attachments as: .zip

Change History (2)

Changed 10 years ago by patrickwhalen

Attachment: width_anomalies.html added

comment:1 Changed 9 years ago by dmethvin

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.