Bug Tracker

Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#8443 closed bug (cantfix)

outerWidth(true) returns wrong values in IE9 and Safari

Reported by: manciaux@… Owned by: mikesherov
Priority: high Milestone: 1.7.2
Component: dimensions Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:


This is the same problem as ticket 3092 - which was closed some time ago. When calculating outerWidth(true) in IE9 and Safari, the value returned is the width + margin implied from the "margin:auto" property Works correctly in IE & Firefox.

The discrepancy happens when

  • the outer div is floated,
  • the inner div has the width set (smaller than the outer div)
  • the inner div has style="margin:auto"

<%@ Page Language="c#" CodeBehind="test1.aspx.cs" AutoEventWireup="True" Inherits="SonicEagle.BrokerAchieve.Errorhandler.test1" %> <!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>

<title>test1</title> <script src="/common/jquery/jquery.js" type="text/javascript"></script>

</head> <body>

<div style="border:1px solid red;width:200px;float:left;">

<div style="width: 100px; display: block;border:1px solid blue;margin: 0px auto;" class="xinner" >

inner div


</div> <input type="button" onclick="test()" /> <div id="results" style="padding-top:30px;"> </div> <script type="text/javascript">

function test() {

$("#results").html('$(".xinner").outerWidth(true): ' + $(".xinner").outerWidth(true));

} $(document).ready(test);


</body> </html>

Change History (12)

comment:1 Changed 12 years ago by manciaux

comment:2 Changed 12 years ago by Rick Waldron

Component: unfileddimensions
Priority: undecidedhigh
Resolution: duplicate
Status: newclosed

comment:3 Changed 12 years ago by Rick Waldron

Duplicate of #3333.

comment:4 Changed 12 years ago by Rick Waldron

Resolution: duplicate
Status: closedreopened

comment:5 Changed 12 years ago by rworth

Not a duplicate of #3333 as first thought as #3333 is WebKit only (does not affect IE9) but this issue affects IE9

Last edited 12 years ago by rworth (previous) (diff)

comment:6 Changed 12 years ago by dmethvin

Status: reopenedopen


comment:7 Changed 12 years ago by mikesherov

this seems to be working as expected in Safari 5.1 using this fiddle: http://jsfiddle.net/pyeNX/1/

I don't have IE9 handy, so I can't tell if it's still broken there.

comment:8 Changed 12 years ago by mikesherov

Milestone: 1.next1.7.2
Owner: set to mikesherov
Status: openassigned

still borked in IE9. I'm on it.

comment:9 Changed 12 years ago by mikesherov

For the record here, IE9 is right. See the discussion here for more info: https://bugs.webkit.org/show_bug.cgi?id=73334

I've pinged FF: https://bugzilla.mozilla.org/show_bug.cgi?id=381328 and I'm going to ping Opera about fixing this in their browsers.

comment:10 Changed 12 years ago by mikesherov

this is now fixed to behave like IE9 in webkit proper: https://bugs.webkit.org/show_bug.cgi?id=73334

comment:11 Changed 11 years ago by mikesherov

Update: also in touch with Opera to get this resolved: https://twitter.com/#!/mikesherov/status/145180476628410370

comment:12 Changed 11 years ago by mikesherov

Resolution: cantfix
Status: assignedclosed

closing this ticket as cantfix as really there is nothing we can do to fix this here. What remains is for FF and Opera to implement the correct behavior as per the spec, and there really is no way to fix this in jQuery.

I've done what I can to advocate for a fix, please continue to advocate for it as well. Thanks for the bug report, please continue to track the issue with the links I provided above!

Note: See TracTickets for help on using tickets.