From b026a975847bd7d2be871a79e33bac501a7ad562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com> Date: Tue, 4 Aug 2026 13:06:21 +0800 Subject: [PATCH 1/3] fix(template): tighten table tag detection --- src/template/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/template/core.js b/src/template/core.js index dd31fee7..3bbf02bc 100644 --- a/src/template/core.js +++ b/src/template/core.js @@ -25,7 +25,7 @@ function createContents(parts) { tableMode = tableMode || signature.match( - /<\s*(table|th|tr|td|thead|tbody|tfoot|caption|colgroup)([^<>]|"[^"]*"|'[^']*')*>\s*$/, + /<\s*(table|th|tr|td|thead|tbody|tfoot|caption|colgroup)(?=[\s>\/])([^<>]|"[^"]*"|'[^']*')*>\s*$/, ); signature += From 7b454dc6a125666f5df5082838a0ea6bd9d4868e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com> Date: Tue, 4 Aug 2026 13:10:34 +0800 Subject: [PATCH 2/3] test(template): cover table-prefixed custom elements --- test/spec/html.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/spec/html.js b/test/spec/html.js index a3a43c1f..c647d6e5 100644 --- a/test/spec/html.js +++ b/test/spec/html.js @@ -839,6 +839,20 @@ describe("html:", () => { expect(fragment.children[0].querySelectorAll("td").length).toBe(4); }); + it("should render custom elements with table tag prefix", () => { + define({ tag: "thead-element" }); + + const render = (value, className) => html` + ${value} +
+ `; + + render("content", "test")(fragment); + + expect(fragment.children[0].textContent).toBe("content"); + expect(fragment.children[1].getAttribute("class")).toBe("test"); + }); + it("should set single expression in element", () => { const render = html` From f1336a6ad3b5f88ea8ee81add86fff3fa5f3a70d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com> Date: Wed, 5 Aug 2026 15:36:13 +0800 Subject: [PATCH 3/3] chore: fix lint --- src/template/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/template/core.js b/src/template/core.js index 3bbf02bc..f7c5b420 100644 --- a/src/template/core.js +++ b/src/template/core.js @@ -25,7 +25,7 @@ function createContents(parts) { tableMode = tableMode || signature.match( - /<\s*(table|th|tr|td|thead|tbody|tfoot|caption|colgroup)(?=[\s>\/])([^<>]|"[^"]*"|'[^']*')*>\s*$/, + /<\s*(table|th|tr|td|thead|tbody|tfoot|caption|colgroup)(?=[\s>/])([^<>]|"[^"]*"|'[^']*')*>\s*$/, ); signature +=