Bug Tracker

Modify

Ticket #11584 (closed bug: invalid)

Opened 14 months ago

Last modified 14 months ago

outerWidth(true) inconsistent on float: none; margin: auto;

Reported by: aquiva@… Owned by:
Priority: low Milestone: None
Component: dimensions Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

 http://jsfiddle.net/4DFSh/1/

outerWidth(true) returns an inconsistent value between browsers when a DIV has no float and auto margins.

Details in the JSFiddle, load in all browsers available to see inconsistency.

Change History

comment:1 Changed 14 months ago by sindresorhus

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to dimensions

.outerWidth(true) will return the width including margins. Since you've set the margin to auto, the margin will fill the width of the window.

comment:2 Changed 14 months ago by anonymous

So cross browser consistency is not desired in jQuery? That seems bizarre.

comment:3 Changed 14 months ago by mikesherov

Of course it's desired. The problem here is that browsers differ here in a way that makes it impossible for us to fix. I've already petitioned the browser vendors to fix this.

What's funny about this fiddle is that it says the "correct" value is 200px. However, when margin is "auto", the value is greater than zero. That's what centers the box. That's why you said auto. The correct value is actually what Chrome reports, 836.

For more information, see here:  https://bugzilla.mozilla.org/show_bug.cgi?id=381328  https://bugs.webkit.org/show_bug.cgi?id=73334

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.