Skip to main content

Bug Tracker

Side navigation

#10117 closed bug (duplicate)

Opened August 23, 2011 10:05AM UTC

Closed November 28, 2011 02:34AM UTC

Last modified April 12, 2012 11:29AM UTC

[chrome] outerWidth(true) returns wrong results with mixed px- and %-values

Reported by: m.schuhfuss@googlemail.com Owned by:
Priority: low Milestone: None
Component: dimensions Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:
Description

In chrome, there is a problem with the calculation of the outerWidth including the margin when, for example, the width is specified in pixels and the margin in percent.

The following code will demonstrate the problem:

http://jsfiddle.net/NXRW2/3/

In this case the margin (10%) will be added to the width (100px) as if it were percent, summing up to the wrong number of 120px.

Attachments (0)
Change History (11)

Changed August 23, 2011 10:06AM UTC by m.schuhfuss@googlemail.com comment:1

Replying to [ticket:10117 m.schuhfuss@…]:

In this case the margin (10%) will be added to the width (100px) as if it were percent, summing up to the wrong number of 120px.

Should read: ... as if it were ''pixels'' ..

Changed August 23, 2011 10:35AM UTC by anonymous comment:2

Even if the width is also specified in percent the result is the same: the width is correctly converted to px whereas the margins are not.

http://jsfiddle.net/NXRW2/4/

Changed September 09, 2011 02:42AM UTC by anonymous comment:3

No surprise, but this is confirmed behaviour in Safari 5.1 as well

Changed September 19, 2011 04:20PM UTC by rwaldron comment:4

component: unfileddimensions
priority: undecidedlow
status: newopen

Changed October 18, 2011 03:35AM UTC by mikesherov comment:5

yeah, percentage values for any of width,padding,margin,or border will result in the answer being goofy. If any of them contain percentages, the whole calculation should report 0.

This is also a needsdocs.

Very similar to ##9945

Changed November 26, 2011 02:55PM UTC by mikesherov comment:6

this is a dupe of #10639 . I know this bug came before #10639, but I have a lot of work done on #10639 already, including a pull request and lots of comments on the trac ticket. Please mark this as a dupe.

Changed November 28, 2011 02:32AM UTC by mikesherov comment:7

resolution: → duplicate
status: openclosed

this is a dupe of #10639

Changed November 28, 2011 02:34AM UTC by mikesherov comment:8

resolution: duplicate
status: closedreopened

Changed November 28, 2011 02:34AM UTC by mikesherov comment:9

resolution: → duplicate
status: reopenedclosed

Changed November 28, 2011 02:34AM UTC by mikesherov comment:10

Duplicate of #10639.

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