Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#10117 closed bug (duplicate)

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

Reported by: m.schuhfuss@… 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.

Change History (11)

comment:1 in reply to:  description Changed 6 years ago by m.schuhfuss@…

Replying to 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 ..

comment:2 Changed 6 years ago by anonymous

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/

comment:3 Changed 6 years ago by anonymous

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

comment:4 Changed 6 years ago by Rick Waldron

Component: unfileddimensions
Priority: undecidedlow
Status: newopen

comment:5 Changed 6 years ago by mikesherov

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

comment:6 Changed 6 years ago by mikesherov

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.

comment:7 Changed 6 years ago by mikesherov

Resolution: duplicate
Status: openclosed

this is a dupe of #10639

comment:8 Changed 6 years ago by mikesherov

Resolution: duplicate
Status: closedreopened

comment:9 Changed 6 years ago by mikesherov

Resolution: duplicate
Status: reopenedclosed

comment:10 Changed 6 years ago by mikesherov

Duplicate of #10639.

Note: See TracTickets for help on using tickets.