From fce294c5a48badca55c92540336888ac36a0c42d Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 30 Oct 2026 11:20:02 +0800 Subject: [PATCH] gui: fitTop's .side-top guard fits app.js's budget again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- internal/gui/assets/app.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 77795837a..482a2e968 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -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; }