#12625 closed bug (duplicate)
Different value from width() and css('width')
Reported by: | SSPPYY | Owned by: | SSPPYY |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | css | Version: | 1.8.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jQuery return different value from width() and css('width') in Firefox 15.0.1 (IE9 and Chrome 22 is OK). Example: var select = $('<select style="width: 120px;"><option value="">X</option></select>'); select.css('width'); return 120px select.width(); return 116
Tested version was 1.8.0 and 1.8.2. This issue not present in version 1.6.2.
Change History (5)
comment:1 follow-up: 2 Changed 11 years ago by
Component: | unfiled → css |
---|---|
Owner: | set to SSPPYY |
Status: | new → pending |
comment:2 Changed 11 years ago by
Status: | pending → new |
---|
Select DOM element was not append to any other element.
Here is test case with code:
http://jsbin.com/upuvil/3/edit
comment:3 Changed 11 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Duplicate of #12071.
Two bits of advice:
- Don't query style information on disconnected nodes. If the styles were applied due to an external stylesheet rather than inline, chrome would report nothing.
- Use .css('width') if you want the width style value, use .width() if you want content width (not including padding or border, as is the case with select elements).
comment:4 Changed 11 years ago by
OK but with older version no problem. I use 1.7.2 at now and i dont have any problem. When i switch to 1.8.0 and newer, crash all my design. And what about back compatibility?
comment:5 Changed 11 years ago by
This was by design. Either you can switch to .css('width'), stick with 1.7.2, or update your designs, but this isn't something we are going to revert.
I am unable to reproduce. http://jsbin.com/iyufoy/1/
Please provide a test case on http://jsfiddle.net or http://jsbin.com.