Mozilla bug - resizing elements

A floated or absolutely positioned element does not have a width and is stretched up by an image. When the image is swapped for a far smaller image, the parent element's width should diminish. Firefox 1.5, though, doesn't diminish the width of the other elements in the floated element, and therefore the parent element retains its original width.

Example

Test

Test

The example elements have these styles:

div.test {
	float: left;
	border: 1px solid #AD007B;
}

div.test2 {
	position: absolute;
	top: 0;
	right: 100px;
	border: 1px solid #AD007B;
}

div p {
	border: 1px solid #AD007B;
}

Note: no width. div.test and div.test2 are stretched up by their widest child element: the image. This is as it should be.

If you click on the image a script replaces the image by a smaller one. Now the floated and absolutely positioned elements should shrink, since its widest element is now the paragraph. In IE (and all other browsers) this happens:

This does not happen in Mozilla. The paragraph retains its old width.