Commit eccad83
committed
Clamp clipped search-result cells via CSS instead of inline height
Building on the read/write split, reduce the per-cell work clipContent()
does and simplify the markup it generates:
- Read line-height once for the table rather than calling
getComputedStyle() for every cell.
- Apply the 5-line clamp in CSS (.clip { max-height: 5lh }) instead of
measuring and setting an inline pixel height per cell, and make
expand/collapse a class toggle (.unclipped) so the click handler does
no layout reads.
- Emit one wrapper div and a single a.clip-toggle button per clipped
cell, replacing the clip-container/clip wrappers and the separate
unclip/reclip anchors. The button swaps its own label on toggle.
This trims the DOM built per clipped cell and removes the per-cell
getComputedStyle calls, further cutting the client-side cost of rendering
wide search results.
Note: the clamp uses the CSS lh unit (Chromium/Edge 109+, Firefox 120+).1 parent d122310 commit eccad83
3 files changed
Lines changed: 40 additions & 48 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1055 | 1055 | | |
1056 | 1056 | | |
1057 | 1057 | | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
1071 | 1064 | | |
1072 | 1065 | | |
1073 | 1066 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1603 | 1603 | | |
1604 | 1604 | | |
1605 | 1605 | | |
1606 | | - | |
1607 | | - | |
1608 | | - | |
1609 | | - | |
1610 | | - | |
1611 | | - | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
1612 | 1624 | | |
1613 | | - | |
1614 | | - | |
1615 | | - | |
1616 | | - | |
1617 | | - | |
1618 | | - | |
1619 | | - | |
1620 | | - | |
1621 | | - | |
1622 | | - | |
1623 | | - | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
1624 | 1629 | | |
1625 | | - | |
| 1630 | + | |
1626 | 1631 | | |
1627 | | - | |
| 1632 | + | |
1628 | 1633 | | |
1629 | | - | |
1630 | | - | |
1631 | | - | |
1632 | | - | |
1633 | | - | |
| 1634 | + | |
1634 | 1635 | | |
1635 | 1636 | | |
1636 | | - | |
1637 | | - | |
1638 | | - | |
1639 | | - | |
| 1637 | + | |
1640 | 1638 | | |
1641 | | - | |
1642 | | - | |
1643 | | - | |
1644 | | - | |
1645 | | - | |
| 1639 | + | |
| 1640 | + | |
1646 | 1641 | | |
1647 | 1642 | | |
1648 | 1643 | | |
| |||
0 commit comments