Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#8663 closed bug (invalid)

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:


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

Change History (7)

comment:1 Changed 12 years ago by kadishmal

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

comment:2 Changed 12 years ago by kadishmal

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).

comment:3 Changed 12 years ago by timmywil

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

comment:4 Changed 12 years ago by kadishmal

I will add the test cases soon. Thanks.

comment:5 Changed 12 years ago by Rick Waldron

Component: unfileddimensions
Owner: set to kadishmal
Status: newpending

comment:6 Changed 12 years ago by trac-o-bot

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!

Note: See TracTickets for help on using tickets.