Bug Tracker

Ticket #11132 (closed bug: cantfix)

Opened 3 years ago

Last modified 3 years ago

.width() on hidden cell messes up table layout in Google Chrome

Reported by: romario333 Owned by:
Priority: low Milestone: None
Component: dimensions Version: 1.7.1
Keywords: Cc: timmywil
Blocking: Blocked by:

Description

When you call .width() on a hidden cell and than make it visible, the cell is shifted to the right from its original position.

This happens only in Google Chrome (16.0.912.63), in Firefox and IE the table renders correctly.

Here is a simple test case:  http://jsfiddle.net/tuR2S/

Change History

comment:1 follow-up: ↓ 3 Changed 3 years ago by timmywil

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to dimensions

There is a temporary swap occurring, but given that all of the settable properties are reset properly, the original fiddle can only be a webkit issue.

Nevertheless, if one uses jQuery to show it, the issue does not occur.

 http://jsfiddle.net/timmywil/tuR2S/2/

comment:2 Changed 3 years ago by romario333

It depends on what element you call width function. When you call it on a single cell, issue still occurs, even if you use jQuery to show it:

 http://jsfiddle.net/romario333/9bqhA/

Version 1, edited 3 years ago by romario333 (previous) (next) (diff)

comment:3 in reply to: ↑ 1 Changed 3 years ago by romario333

Replying to timmywil:

There is a temporary swap occurring, but given that all of the settable properties are reset properly, the original fiddle can only be a webkit issue.

Nevertheless, if one uses jQuery to show it, the issue does not occur.

 http://jsfiddle.net/timmywil/tuR2S/2/

Not true, when you call show and width on a single cell, issue still occurs:

 http://jsfiddle.net/romario333/9bqhA/

comment:4 Changed 3 years ago by romario333

I've reported this issue to WebKit project:

 https://bugs.webkit.org/show_bug.cgi?id=75798

I believe jQuery should have workaround for this bug though as I don't know how long it will take guys at WebKit to fix it.

comment:5 Changed 3 years ago by addyosmani

#11156 is a duplicate of this ticket.

comment:6 Changed 3 years ago by addyosmani

  • Cc timmywil added
  • Keywords needsreview added
  • Status changed from closed to reopened
  • Resolution invalid deleted

Re-opening as this was brought up again in http://bugs.jquery.com/ticket/11156. Given that the submitter believes this is a WebKit issue, do we feel it's widely enough experienced to even consider a workaround?

comment:7 Changed 3 years ago by timmywil

  • Keywords needsreview removed
  • Status changed from reopened to closed
  • Resolution set to cantfix

It seems the duplicate was created by the op of this ticket. @romario333: Let's keep the discussion of this issue in this ticket.

As I said before, I don't think there's anything we can do since the css is being reset to their original display values correctly, but webkit is not rendering as it should. A workaround is to show the cell in webkit with .css('display', 'block'), but this would not be viable for core.

 http://jsfiddle.net/timmywil/9bqhA/1/

comment:8 Changed 3 years ago by romario333

Ok, I understand that this cannot be easily solved in core.

Your workaround works only in simple scenarios. Problem is that table cell's display should be "table-cell" rather than "block". When it's set to "block", it can lead to other formatting issues. But when you set it to "table-cell", workaround no longer works :(

Note: See TracTickets for help on using tickets.