From 3fbb2904eff8618a5de36587375c299b3e0e6b43 Mon Sep 17 00:00:00 2001 From: commilitia Date: Sat, 11 Jul 2026 13:31:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(split):=20=E6=94=80=E5=8D=87=E5=B0=8D?= =?UTF-8?q?=E7=A8=B1=E5=AE=88=E8=A1=9B=E2=80=94=E2=80=94=E5=88=87=E5=88=86?= =?UTF-8?q?=E5=89=8D=E9=A9=97=E6=95=B4=E6=A2=9D=E7=A5=96=E5=85=88=E9=8F=88?= =?UTF-8?q?=E5=8F=AF=E5=88=87=EF=BC=8Copaque=20=E4=B8=AD=E9=96=93=E7=A5=96?= =?UTF-8?q?=E5=85=88=E4=B8=8D=E5=86=8D=E8=A2=AB=E5=85=8B=E9=9A=86=E8=82=A2?= =?UTF-8?q?=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 下游 .selection-bar-message 病例:段末實義字落於 opaque

', + ); + createJuzhen().render(document.body); + const p = document.querySelector("p"); + const orphan = p.querySelector("jz-orphan"); + assert.ok(orphan, "應產生 jz-orphan"); + assert.equal(countTag(document.body, '[data-jz-kind="splitoff"]'), 0, "無克隆切分殼層(button 未被肢解)"); + assert.equal(p.querySelectorAll("button").length, 1, "button 未被複製(仍單一)"); + assert.equal(p.querySelector("button").textContent, "結尾文字", "button 內容完整無缺"); + assert.equal(orphan.textContent, "接續結尾文字", "退化綁定整個 span(含 button)"); + assert.equal(p.textContent, "開頭較長的一段文字內容之後接續結尾文字", "textContent 不變"); +}); + +test("垂懸字 攀升守衛 revert:綁整 span 之退化路徑 render→revert 還原一致", () => +{ + const { document } = setupDom( + '

開頭較長的一段文字內容之後接續

', + ); + const jz = createJuzhen(); + jz.render(document.body); + jz.revert(document.body); + const p = document.querySelector("p"); + assert.equal(countTag(p, "jz-orphan"), 0, "無殘留 jz-orphan"); + assert.equal(p.querySelectorAll("span").length, 1, "span 單一"); + assert.equal(p.querySelectorAll("button").length, 1, "button 單一"); + assert.equal(p.textContent, "開頭較長的一段文字內容之後接續結尾文字", "textContent 還原"); +}); + // ----- 標點懸掛已移除(§6.5.6):hanging 選項保留為 no-op,永不產生 jz-hang-* ----- // 純負 margin 機制為機制級死路(寬度守恆矛盾,CSS 接觸不到斷行器);原生 // hanging-punctuation 為唯一正解但僅 Safari 支援、且與 inline-block 原子互斥。