Skip to content

fix(template): avoid treating table-prefixed custom elements as table tags - #306

Merged
smalluban merged 3 commits into
hybridsjs:mainfrom
liweijie0812:fix/table-tag-signature-regex
Aug 5, 2026
Merged

fix(template): avoid treating table-prefixed custom elements as table tags#306
smalluban merged 3 commits into
hybridsjs:mainfrom
liweijie0812:fix/table-tag-signature-regex

Conversation

@liweijie0812

Copy link
Copy Markdown
Contributor

Summary

Fix table tag detection in createContents so it only matches real table-related tags when the tag name is followed by whitespace, >, or /.

Problem

The previous regex could incorrectly match custom element names that start with a table tag name.

example:

html`<thead-element></thead-element>`
Before this change, <thead-element> could be treated as if it started with <thead>, because the regex matched the thead prefix.
Fix
Add a lookahead after the table tag group:
(?=[\s>\/])
This ensures matches like <thead>, <thead class="x">, and <thead/> still work, while <thead-element> does not match as a table tag.

@smalluban smalluban left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. The fix looks great!

@smalluban smalluban left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the code, so the linter check passes.

@liweijie0812

Copy link
Copy Markdown
Contributor Author

Please update the code, so the linter check passes.

done

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 99.957%. remained the same — liweijie0812:fix/table-tag-signature-regex into hybridsjs:main

@smalluban
smalluban merged commit 6ba99e5 into hybridsjs:main Aug 5, 2026
2 checks passed
@liweijie0812
liweijie0812 deleted the fix/table-tag-signature-regex branch August 5, 2026 08:51
@liweijie0812

Copy link
Copy Markdown
Contributor Author

When will a bug fix be released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants