Skip to content

Conversation

@mgol
Copy link
Member

@mgol mgol commented Feb 24, 2025

Summary

3.x version of PR #5630. In this one, we are keeping the style swap even for table col elements for compat reasons.

Changes:

  1. Fix measurements of <col span="2"> elements in Firefox.
  2. Fix measurements of all implicitly sized <col> elements in Safari.

Firefox always reports computed width as if span was 1. In Safari, computed width for columns is always 0. Work around both issues by using offsetWidth.

In IE/Edge, <col> computed width is "auto" unless width is set explicitly via CSS so measurements there remain incorrect. Because of the lack of a proper workaround, we accept this limitation.

Fixes gh-5628

Checklist

@mgol mgol self-assigned this Feb 24, 2025
Changes:
1. Fix measurements of `<col span="2">` elements in Firefox.
2. Fix measurements of all implicitly sized `<col>` elements in Safari.

Firefox always reports computed width as if `span` was 1. In Safari, computed
width for columns is always 0. Work around both issues by using `offsetWidth`.

In IE/Edge, `<col>` computed width is `"auto"` unless `width` is set explicitly
via CSS so measurements there remain incorrect. Because of the lack of a proper
workaround, we accept this limitation.

Fixes jquerygh-5628
@mgol mgol force-pushed the 3.x-col-width-fixes branch from 91189bd to 67709ce Compare February 24, 2025 17:14
@mgol mgol linked an issue Feb 24, 2025 that may be closed by this pull request
@mgol mgol added this to the 3.7.2 milestone Feb 24, 2025
mgol added a commit that referenced this pull request Feb 24, 2025
Changes:
1. Fix measurements of `<col span="2">` elements in Firefox.
2. Fix measurements of all implicitly sized `<col>` elements in Safari.

Firefox always reports computed width as if `span` was 1. In Safari, computed
width for columns is always 0. Work around both issues by using `offsetWidth`.

In IE/Edge, `<col>` computed width is `"auto"` unless `width` is set explicitly
via CSS so measurements there remain incorrect. Because of the lack of a proper
workaround, we accept this limitation.

Fixes gh-5628
Closes gh-5630
Ref gh-5634
@mgol
Copy link
Member Author

mgol commented Feb 24, 2025

Size diff:

3.x-stable @6b7d74a1ea9a0004baf720ffb84f53f261e78c58
   raw     gz     br Filename
  +185    +42    -17 dist/jquery.min.js
  +185    +42    +27 dist/jquery.slim.min.js

@mgol mgol removed the Needs review label Feb 24, 2025
@mgol mgol merged commit 3f70fbc into jquery:3.x-stable Feb 24, 2025
17 checks passed
@mgol mgol deleted the 3.x-col-width-fixes branch February 24, 2025 17:50
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Development

Successfully merging this pull request may close these issues.

Reconsider the width/height css hooks CSS swap behavior

3 participants