gui: fitTop's .side-top guard fits app.js's budget again

6db21d869 guarded fitTop's .side-top with an if block and a comment,
which put app.js 64 bytes over TestCoreScriptBudget's budget (app.js
1315380 > 1315316, the core 1537098 > 1537034), and I pushed it without
running internal/gui's Go tests. The guard is now optional chaining
(st?.classList…, which skips the whole call and its arguments when
there is no .side-top), and st is declared with fitTop's other
elements, so app.js is 14 bytes under the budget it had. The budget is
not raised.

Run (on mote, through mote-run):
- go test -run 'TestCoreScriptBudget|TestMainWindowCorners' ./internal/gui:
  TestCoreScriptBudget passes (failed at 6db21d869).
  TestMainWindowCorners/macOS_26_SDK is red, the same at d19afb4c9,
  before either commit: #3949 (macOS 27 on mote).
- number-units.test.cjs, chromium and webkit: 6 of 6 pass.
This commit is contained in:
yetone
2026-10-30 11:20:06 +08:00
parent 7fd65aad56
commit fce294c5a4
+3 -7
View File
@@ -23590,13 +23590,9 @@ matchMedia("(max-width: 760px), (pointer: coarse) and (max-width: 1024px)").addE
// centring and take the room between, and at the narrowest they draw in,
// further still when they don't fit (the 560px window at 150%).
function fitTop() {
const top = $(".top"), nav = $("#nav"), brand = $(".brand"), actions = $(".actions");
// the tray panel has no sidebar, so no .side-top
const st = $(".side-top");
if (st) {
st.classList.remove("tight");
st.classList.toggle("tight", st.scrollWidth > st.clientWidth);
}
const top = $(".top"), nav = $("#nav"), brand = $(".brand"), actions = $(".actions"), st = $(".side-top");
st?.classList.remove("tight");
st?.classList.toggle("tight", st.scrollWidth > st.clientWidth);
// a phone's browser: the tabs have a row of their own (app.css), at their size;
// and beside the sidebar the header holds only where the reader is and the icons
if (phoneWeb() || sideNav()) { top.classList.remove("tight", "cramped", "inrow", "crowded", "packed"); return; }