Skip to main content

Bug Tracker

Side navigation

#11009 closed bug (duplicate)

Opened December 13, 2011 10:05AM UTC

Closed December 14, 2011 02:31PM UTC

Last modified December 14, 2011 02:31PM UTC

jQuery not considering current box model when returning current width of element.

Reported by: gabrycir@hotmail.it Owned by: gabrycir@hotmail.it
Priority: low Milestone: None
Component: dimensions Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

When using a css like this (using a different box model than the default):

#container {

padding: 12px;

box-sizing: border-box;

width: 500px;

}

when calling

$("#container").width();

I will receive 476 instead of 500, meaning it doesn't count the 24px padding.

Attachments (0)
Change History (4)

Changed December 13, 2011 10:42AM UTC by sindresorhus comment:1

owner: → gabrycir@hotmail.it
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

Changed December 13, 2011 10:17PM UTC by jpate comment:2

looks like a duplicate of #11004

which I have mostly solved (works but doesn't deal with ie6/7 which don't support box-sizing css (they treat everything as box-sizing:border-box))

Changed December 14, 2011 02:31PM UTC by timmywil comment:3

component: unfileddimensions
priority: undecidedlow
resolution: → duplicate
status: pendingclosed

Changed December 14, 2011 02:31PM UTC by timmywil comment:4

Duplicate of #11004.