Skip to main content

Bug Tracker

Side navigation

#4869 closed bug (worksforme)

Opened July 08, 2009 08:02PM UTC

Closed November 18, 2010 02:41AM UTC

Last modified March 15, 2012 03:55PM UTC

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:

1. Create a div that is floated left (or has some other css attribute that will cause its width to reduce to its content).

2. Place a sentence of text inside the div.

3. Get the div's width. var theWidth = $('#myDiv').width();

4. 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)
Change History (1)

Changed November 18, 2010 02:41AM UTC by dmethvin comment:1

resolution: → worksforme
status: newclosed