#12071 closed bug (wontfix)
width() return correct value with one shift pixel on FF13
Reported by: | Owned by: | Rick Waldron | |
---|---|---|---|
Priority: | blocker | Milestone: | None |
Component: | css | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When I use width() on a table tag, it returns the correct value minus one pixel.
To reproduce : http://jsfiddle.net/Mouxon/TRGHK/ Click several time on the button.
Change History (11)
comment:1 Changed 11 years ago by
Component: | unfiled → css |
---|---|
Owner: | set to Rick Waldron |
Priority: | undecided → blocker |
Status: | new → assigned |
comment:2 Changed 11 years ago by
Further reduction, will be used as test basis: http://jsfiddle.net/rwaldron/cZSST/
comment:3 Changed 10 years ago by
rwaldron, .width() removes padding and border. In FF, table elements inherit the largest border of the first column in each row: http://jsfiddle.net/cZSST/7/ In Chrome, this is a different story. As a matter of fact, even their .css('width')'s are different as well.
My first thought here is "patchwelcome" or "cantfix", as it seems like the solution would involve a feature detect, followed by detecting if the thing you're asking for the .width() is a table, and then looking at the first td/th in every row, and seeing if that is effecting the border result.
Even then, I'm not sure if we could tell if the table's border is being screwed with by the td/th's border, because what if the td and the table have the same border width?
Let me know what you want to do here.
comment:4 Changed 10 years ago by
Looked into this further... there's more going on here than my previous comment suggests. Continuing to investigate.
comment:5 Changed 10 years ago by
@mikesherov I've narrowed it down to the existence of a 1px border causes the issue:
comment:7 Changed 10 years ago by
rwaldron: figured out what's going on here. In 1.8, I separated out a difference between .css('width') and .width()... .width() respects box-sizing (in that it always attempts to both get and set actual content width), and .css('width') does not (in that it attempts to set the css version of .width()).
In firefox, the default box-sizing for tables are border-box, whereas it's content-box in the other browsers! : http://jsfiddle.net/xkhgT/5/
This is essentially wontfix as the solution is to just use .css('width') instead of .width(). I'm tempted to say that we can pave over this difference by redirecting table to use .css('width') when .width() is called, but that breaks the ability to use content-box for tables if you'd want to.
Thoughts?
comment:8 Changed 10 years ago by
- We should probably tell Mozilla about this one,
- CSS "resetters" should be told about this too.
comment:10 Changed 10 years ago by
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
@mikesherov excellent sleuthing :)
Confirmed. Further reduction: http://jsfiddle.net/rwaldron/pSDxy/
http://gyazo.com/88b80e7b73ea75fd9ccf86692fb6ab27