fix: size the upstream table by a class

The cross-reference upstream table was reached with
.sl-heading-wrapper:has(> #by-upstream-emulator) ~ section, which the
browser matched again for every block added after any heading of any
page: about 400 ms of style work while the gaps page loads (mobile, 4x
CPU throttling, 586 ms down to 200 ms). The table sits in a
.rb-xref-upstream block, and the address column is its second.
This commit is contained in:
Abdessamad Derraz committed 2026-11-19 18:42:55 +01:00
1 parent cb23f7f8a4
commit 9760c2fadd
3 files changed
+28 -11

No files matched your search

+8 -1
View File
@@ -201,9 +201,16 @@ class ThemeStylesheet(unittest.TestCase):
self.assertNotRegex(self.css, r"\.rb-meta-card td \{ overflow-wrap: anywhere")
self.assertIn("overflow-wrap: anywhere", _rules(self.css, ".rb-meta-card td code")[0])
self.assertIn("width: 40%", "".join(_rules(self.css, ".rb-meta-card td:first-child")))
upstream = _rules(self.css, "#by-upstream-emulator")[0]
upstream = _rules(self.css, ".rb-xref-upstream td:nth-child(2)")[0]
self.assertIn("max-width: 22rem", upstream)
def test_no_has_before_a_sibling_combinator(self):
"""`.sl-heading-wrapper:has(> #by-upstream-emulator) ~ section` was
matched again for every block added after any heading: 400 ms of
style work on the gaps page (mobile, 4x CPU throttling)."""
for selector, _body in _blocks(self.css):
self.assertNotRegex(selector, r":has\([^)]*\)[^,{]*~", selector)
def test_two_column_tables_stack_label_over_value(self):
self.assertIn("content: none", _rules(self.css, "table[data-rb-stack='kv'] td::before")[0])
self.assertTrue(_rules(self.css, "table[data-rb-stack='kv'] td:first-child"))