Skip to main content

Bug Tracker

Side navigation

#8663 closed bug (invalid)

Opened March 27, 2011 12:41AM UTC

Closed April 12, 2011 07:45AM UTC

Last modified April 12, 2012 11:30AM UTC

outerWidth Bug in Chrome and Safari

Reported by: kadishmal Owned by: kadishmal
Priority: undecided Milestone: 1.next
Component: dimensions Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:
Description

There seem to be a bug in the jQuery outerWidth calculations when running in Chrome and Safari. But as these two belong to Webkit, I suppose maybe it's their bug. Anyhow, please look at these.

My "body" tag width is 1521px.

It has one child called "page": width=950, border=1, padding=0, margin=0 auto. This margin configuration makes it center horizontally.

Hence, outerWidth of page should be 952.

But in Chrome/Safari:

page.offset().left = 293

page.outerWidth(true) = 1538

In IE:

page.offset().left = 291

page.outerWidth(true) = 952

In Firefox:

page.offset().left = 293

page.outerWidth(true) = 952

If it is jQuery bug, then I assume it is as a result of "margin:0 auto". Perhaps it cannot calculate the outerWidth correctly in this case.

Chrome: 10.0

Safari: 5.0

IE: 8.0

FF: 4.0

jQuery: 1.4.4

Attachments (0)
Change History (7)

Changed March 27, 2011 12:44AM UTC by kadishmal comment:1

The "body" tag without the scroller is 1538px. So Chrome and Safari somehow return the width of the parent "body" tag.

Changed March 27, 2011 12:51AM UTC by kadishmal comment:2

Oh, I think Chrome and Safari compute it correctly, as if "margin:0 auto" the margin left and right become 293, which is true. But IE/FF do not include this margin.

When I do page.outerWidth() - without passing "true" argument, all browsers return what I expected 952.

So, perhaps, you have to look at why IE and FF do not include the margin when outerWidth(true).

Changed March 28, 2011 10:54PM UTC by timmywil comment:3

My guess is that this is a duplicate of #3333. Perhaps you could provide a test case on jsfiddle.net.

Changed March 29, 2011 02:13AM UTC by kadishmal comment:4

I will add the test cases soon. Thanks.

Changed March 29, 2011 02:39AM UTC by rwaldron comment:5

component: unfileddimensions
owner: → kadishmal
status: newpending

Changed April 12, 2011 07:45AM UTC by trac-o-bot comment:6

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Changed April 12, 2012 11:30AM UTC by anonymous comment:7