Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#12071 closed bug (wontfix)

width() return correct value with one shift pixel on FF13

Reported by: [email protected] Owned by: Rick Waldron
Priority: blocker Milestone: None
Component: css Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:


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 10 years ago by Rick Waldron

Component: unfiledcss
Owner: set to Rick Waldron
Priority: undecidedblocker
Status: newassigned

comment:2 Changed 10 years ago by Rick Waldron

Further reduction, will be used as test basis: http://jsfiddle.net/rwaldron/cZSST/

comment:3 Changed 10 years ago by mikesherov

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 mikesherov

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 Rick Waldron

@mikesherov I've narrowed it down to the existence of a 1px border causes the issue:


comment:6 Changed 10 years ago by Rick Waldron

#12546 is a duplicate of this ticket.

comment:7 Changed 10 years ago by mikesherov

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.


comment:8 Changed 10 years ago by jaubourg

  • We should probably tell Mozilla about this one,
  • CSS "resetters" should be told about this too.

comment:10 Changed 10 years ago by Rick Waldron

Resolution: wontfix
Status: assignedclosed

@mikesherov excellent sleuthing :)

comment:11 Changed 10 years ago by mikesherov

#12625 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.