diff --git a/src/template/core.js b/src/template/core.js
index dd31fee7..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*(table|th|tr|td|thead|tbody|tfoot|caption|colgroup)(?=[\s>/])([^<>]|"[^"]*"|'[^']*')*>\s*$/,
);
signature +=
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`
+